Undeploy targets

Remove (undeploy) infrastructure configured with config sets from the specified deployment groups and targets.

Usage

1tkm targets undeploy [group-path...] \
2  [--target <target>]... \
3  [--exclude-target <target>]... \
4  [--label <label>]... \
5  [--exclude-label <label>]... \
6  [--concurrent-targets <count>] \
7  [--config-set <config-set>] \
8  [--command-path <command-path>] \
9  [--reset-cache]

Positional arguments

  • group-path
    • Provide one or more deployment group paths to remove only the targets that belong to the deployment groups located under the given deployment group paths in the deployment groups hierarchy.
    • Optional.

Options

In addition to the common options, this command has the following options.

  • --label <label>
    • Choose deployment targets by label. You can use this option multiple times to specify more labels.
    • Optional
  • --exclude-label <label>
    • Exclude deployment targets by label. You can use this option multiple times to specify more labels.
    • Optional
  • --target <target>
    • Deployment targets to remove. You can use this option multiple times to specify more targets. You can use % character as a wildcard at the beginning and/or end of the target name to more than one target.
    • Optional
  • --exclude-target <target>
    • Exclude deployment targets. You can use this option multiple times to specify more targets. You can use % character as a wildcard at the beginning and/or end of the target name to more than one target.
    • Optional
  • --concurrent-targets <number>
    • Number of deployment targets to remove concurrently. Defaults to 1. If you choose to review changes to each target, this is set to 1.
    • Optional
  • --config-set <config-set>
    • Undeploy only this config set.
    • Optional
  • --command-path <command-path>
    • Undeploy only stacks under this command path.
    • To use this option, also the --config-set option must be given.
  • --reset-cache
    • Reset cached files under .takomo-cache dir

IAM permissions

1# Minimum permissions. Additional permissions are needed to actually 
2# remove the resources defined in CloudFormation templates.
3Statement: 
4  - Sid: Stacks
5    Effect: Allow
6    Action:
7      - cloudformation:DescribeStackEvents
8      - cloudformation:DeleteStack
9      - cloudformation:DescribeStacks
10    Resource: "*"
11
12  # IAM permissions needed only if command roles are used  
13  # Specify resource to restrict access to specific roles.  
14  - Sid: IAM
15    Effect: Allow
16    Action:
17      - sts:AssumeRole
18    Resource: "*"

Examples

Undeploy all deployment targets

1tkm targets undeploy

Undeploy only targets that belong to a deployment group MyGroup or to any other deployment group under it

1tkm targets undeploy MyGroup

Undeploy only the deployment target named my-target

1tkm targets undeploy --target my-target

Undeploy all deployment targets whose name ends with -test

1tkm targets undeploy --target %-test

Undeploy all targets that have label application

1tkm targets undeploy --label application