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:

    1. task {
    2. name = "task_a"
    3. description = ""
    4. enabled = true,
    5. providers = []
    6. module = "org/example/module"
    7. version = "1.0.0"
    8. variable_files = []
    9. condition "services" {
    10. names = ["web", "api"]
    11. }
    12. }

    Shell Session:

    1. $ consul-terraform-sync task create -task-file=task_example.hcl
    2. ==> Inspecting changes to resource if creating task 'task_a'...
    3. Generating plan that Consul-Terraform-Sync will use Terraform to execute
    4. Request ID: 1da3e8e0-87c3-069b-51a6-46903e794a76
    5. Request Payload:
    6. // <request payload truncated>
    7. Plan:
    8. Terraform used the selected providers to generate the following execution
    9. plan. Resource actions are indicated with the following symbols:
    10. + create
    11. Terraform will perform the following actions:
    12. // <diff truncated>
    13. ==> Creating the task will perform the actions described above.
    14. Do you want to perform these actions for 'task_a'?
    15. - This action cannot be undone.
    16. - Consul-Terraform-Sync cannot guarantee Terraform will perform
    17. these exact actions if monitored services have changed.
    18. Only 'yes' will be accepted to approve, enter 'no' or leave blank to reject.
    19. ==> Creating and running task 'api-task'...
    20. The task creation request has been sent to the CTS server.
    21. Please be patient as it may take some time to see a confirmation that this task has completed.
    22. Warning: Terminating this process will not stop task creation.
    23. ==> Task 'task_a' created
    24. Request ID: '78eddd74-0f08-83d6-72b2-6aaac1424fba'

    consul-terraform-sync task enable [options] <task_name>

    Arguments:

    NameRequiredTypeDescription
    task_nameRequiredstringThe name of the task to enable.

    Options:

    In addition to general options this command also supports the following:

    Example

    1. $ consul-terraform-sync task enable task_a
    2. ==> Inspecting changes to resource if enabling 'task_a'...
    3. Generating plan that Consul-Terraform-Sync will use Terraform to execute
    4. An execution plan has been generated and is shown below.
    5. Resource actions are indicated with the following symbols:
    6. + create
    7. Terraform will perform the following actions:
    8. // <diff truncated>
    9. Plan: 3 to add, 0 to change, 0 to destroy.
    10. ==> Enabling the task will perform the actions described above.
    11. Do you want to perform these actions for 'task_a'?
    12. - This action cannot be undone.
    13. - Consul-Terraform-Sync cannot guarantee Terraform will perform
    14. these exact actions if monitored services have changed.
    15. Only 'yes' will be accepted to approve.
    16. Enter a value: yes
    17. ==> Enabling and running 'task_a'...
    18. ==> 'task_a' enable complete!
    1. $ consul-terraform-sync task enable task_a
    2. ==> Inspecting changes to resource if enabling 'task_a'...
    3. Generating plan that Consul-Terraform-Sync will use Terraform to execute
    4. Resource actions are indicated with the following symbols:
    5. + create
    6. Terraform will perform the following actions:
    7. // <diff truncated>
    8. Plan: 3 to add, 0 to change, 0 to destroy.
    9. ==> Enabling the task will perform the actions described above.
    10. Do you want to perform these actions for 'task_a'?
    11. - This action cannot be undone.
    12. - Consul-Terraform-Sync cannot guarantee Terraform will perform
    13. these exact actions if monitored services have changed.
    14. Only 'yes' will be accepted to approve.
    15. Enter a value: yes
    16. ==> Enabling and running 'task_a'...
    17. ==> '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>

    NameRequiredTypeDescription
    task_nameRequiredstringThe name of the task to disable.

    Options: Currently only supporting general options

    Example

    1. $ consul-terraform-sync task disable task_b
    2. ==> Waiting to disable 'task_b'...
    3. ==> '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:

    NameRequiredTypeDescription
    -auto-approveOptionalbooleanWhether to skip the interactive approval of the task deletion.

    Example

    1. $ consul-terraform-sync task delete task_a
    2. ==> Do you want to delete 'task_a'?
    3. - This action cannot be undone.
    4. - Deleting a task will not destroy the infrastructure managed by the task.
    5. - If the task is not running, it will be deleted immediately.
    6. - If the task is running, it will be deleted once it has completed.
    7. Only 'yes' will be accepted to approve, enter 'no' or leave blank to reject.
    8. Enter a value: yes
    9. ==> Marking task 'task_a' for deletion...