Task task
Describes a task the user needs to perform, which can be included into docs
.
Tasks can be validated using the check
defined in the conditions.
The task can also be skipped, which will instead run the solve
to complete the task.
Properties
- Name
config
- Type
- (config: {})
- Required
- Readonly
- Description
Allows you to specify configuration for the conditions of this task.
These values can be overridden within the validation of individual conditions.
- Name
condition
- Type
- (condition: {})
- Required
- Readonly
- Description
Allows you to specify conditions that need to be met in order to complete the task.
This stanza can be specified multiple times.
- Name
prerequisites
- Type
- ([]string: [])
- Required
- Readonly
- Description
A list containing the IDs of
task
resources that need to be completed before the task unlocks.
Config
Configuration that will be used for conditions when no values are specified for the validation of individual conditions.
- Name
timeout
- Type
- (int: 10)
- Required
- Readonly
- Description
The number of seconds to wait before timing out the validation.
- Name
target
- Type
- (string: "")
- Required
- Readonly
- Description
The target where the validation should be executed.
- Name
user
- Type
- (string: "")
- Required
- Readonly
- Description
The user the validation should be executed as.
- Name
group
- Type
- (string: "")
- Required
- Readonly
- Description
The group the validation should be executed as.
- Name
working_directory
- Type
- (string: "")
- Required
- Readonly
- Description
The directory the validation should be executed in.
Condition
Allows you to validate if a user has completed the task.
- Name
name
- Type
- (string: "")
- Required
- required
- Readonly
- Description
The name of the condition.
- Name
description
- Type
- (string: "")
- Required
- required
- Readonly
- Description
The description of the condition. This is displayed to the user to describe what condition needs to be met.
- Name
setup
- Type
- (validation: {})
- Required
- Readonly
- Description
The setup will be executed when the task gets unlocked.
- Name
cleanup
- Type
- (validation: {})
- Required
- Readonly
- Description
The cleanup will be executed when the task gets completed or skipped.
- Name
check
- Type
- (validation: {})
- Required
- Readonly
- Description
A check that will be executed when validating the condition.
- Name
solve
- Type
- (validation: {})
- Required
- Readonly
- Description
A solution that will be applied when skipping the condition.
Validation
- Name
script
- Type
- (string: "")
- Required
- required
- Readonly
- Description
The script that is executed when running the validation.
- Name
failure_message
- Type
- (string: "")
- Required
- required
- Readonly
- Description
The message that is returned when the validation of the condition fails.
- Name
success_message
- Type
- (string: "")
- Required
- Readonly
- Description
The message that is returned when the validation of the condition succeeds.
- Name
target
- Type
- (string: "")
- Required
- Readonly
- Description
The target where the validation should be executed.
- Name
user
- Type
- (string: "")
- Required
- Readonly
- Description
The user the validation should be executed as.
- Name
group
- Type
- (string: "")
- Required
- Readonly
- Description
The group the validation should be executed as.
- Name
working_directory
- Type
- (string: "")
- Required
- Readonly
- Description
The directory the validation should be executed in.
Examples
resource "task" "manual_installation" {
prerequisites = []
config {
user = "root"
target = variable.terraform_target
}
condition "binary_exists" {
description = "Terraform installed on path"
check {
script = file("checks/installation/manual_installation/binary_exists")
failure_message = "terraform binary not found on the PATH"
}
solve {
script = file("checks/installation/manual_installation/solve")
timeout = 60
}
}
condition "latest_version" {
description = "Terraform binary is the latest version"
check {
script = template_file("checks/installation/manual_installation/version_latest", { name = "terraform"})
failure_message = "terraform binary is not the latest version"
}
}
}