task
It is not to be used for updating a task and will not create a task if the task name already exists.
consul-terraform-sync task create [options] -task-file=<task config>
Options:
In addition to general options this command also supports the following:
Example
task_example.hcl:
task {
name = "task_a"
description = ""
enabled = true,
providers = []
module = "org/example/module"
version = "1.0.0"
variable_files = []
condition "services" {
names = ["web", "api"]
}
}
Shell Session:
$ consul-terraform-sync task create -task-file=task_example.hcl
==> Inspecting changes to resource if creating task 'task_a'...
Generating plan that Consul-Terraform-Sync will use Terraform to execute
Request ID: 1da3e8e0-87c3-069b-51a6-46903e794a76
Request Payload:
// <request payload truncated>
Plan:
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
// <diff truncated>
==> Creating the task will perform the actions described above.
Do you want to perform these actions for 'task_a'?
- This action cannot be undone.
- Consul-Terraform-Sync cannot guarantee Terraform will perform
these exact actions if monitored services have changed.
Only 'yes' will be accepted to approve, enter 'no' or leave blank to reject.
==> Creating and running task 'api-task'...
The task creation request has been sent to the CTS server.
Please be patient as it may take some time to see a confirmation that this task has completed.
Warning: Terminating this process will not stop task creation.
==> Task 'task_a' created
Request ID: '78eddd74-0f08-83d6-72b2-6aaac1424fba'
consul-terraform-sync task enable [options] <task_name>
Arguments:
Name | Required | Type | Description |
---|---|---|---|
task_name | Required | string | The name of the task to enable. |
Options:
In addition to general options this command also supports the following:
Example
$ consul-terraform-sync task enable task_a
==> Inspecting changes to resource if enabling 'task_a'...
Generating plan that Consul-Terraform-Sync will use Terraform to execute
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
// <diff truncated>
Plan: 3 to add, 0 to change, 0 to destroy.
==> Enabling the task will perform the actions described above.
Do you want to perform these actions for 'task_a'?
- This action cannot be undone.
- Consul-Terraform-Sync cannot guarantee Terraform will perform
these exact actions if monitored services have changed.
Only 'yes' will be accepted to approve.
Enter a value: yes
==> Enabling and running 'task_a'...
==> 'task_a' enable complete!
$ consul-terraform-sync task enable task_a
==> Inspecting changes to resource if enabling 'task_a'...
Generating plan that Consul-Terraform-Sync will use Terraform to execute
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
// <diff truncated>
Plan: 3 to add, 0 to change, 0 to destroy.
==> Enabling the task will perform the actions described above.
Do you want to perform these actions for 'task_a'?
- This action cannot be undone.
- Consul-Terraform-Sync cannot guarantee Terraform will perform
these exact actions if monitored services have changed.
Only 'yes' will be accepted to approve.
Enter a value: yes
==> Enabling and running 'task_a'...
==> 'task_a' enable complete!
task disable
command disables an existing task so that it will no longer run and update task resources. If the task is already disabled, it will return a success.
consul-terraform-sync task disable [options] <task_name>
Name | Required | Type | Description |
---|---|---|---|
task_name | Required | string | The name of the task to disable. |
Options: Currently only supporting general options
Example
$ consul-terraform-sync task disable task_b
==> Waiting to disable 'task_b'...
==> 'task_b' disable complete!
task delete
command deletes an existing task. The command will ask the user for approval before deleting the task. The task will be marked for deletion and will be deleted immediately if it is not running. Otherwise, the task will be deleted once it has completed.
Note: Deleting a task will not destroy the infrastructure managed by the task.
consul-terraform-sync task delete [options] <task_name>
Arguments:
Options:
Name | Required | Type | Description |
---|---|---|---|
-auto-approve | Optional | boolean | Whether to skip the interactive approval of the task deletion. |
Example
$ consul-terraform-sync task delete task_a
==> Do you want to delete 'task_a'?
- This action cannot be undone.
- Deleting a task will not destroy the infrastructure managed by the task.
- If the task is not running, it will be deleted immediately.
- If the task is running, it will be deleted once it has completed.
Only 'yes' will be accepted to approve, enter 'no' or leave blank to reject.
Enter a value: yes
==> Marking task 'task_a' for deletion...