Introduction

tfc-toolset is a collection of tools to help in management of your Terraform cloud organization.

What's in the box?

  • Wrath.

  • tfc-toolset: The core library containing common functions for working with the Terraform cloud API. Each tool extends upon this library to accomplish its specific purpose.

  • tfc-toolset-extras: Extends the core library with more optional functionality.

  • tfct: A command line tool for interacting with the Terraform cloud API that builds off the core library.

  • tfc-report-tui: Reading large JSON payloads can be a headache, this maybe slightly less so.

Why?

Because I like a side of automation with my automation. nom nom nom

Libraries

The following libraries are provided this toolset:

tfc-toolset

The core library containing common functions for working with the Terraform cloud API. Each tool extends upon this library to accomplish its specific purpose.

tfc-toolset

Todo!

tfc-toolset-extras

Todo!

Tools

The following tools are provided this toolset:

tfct

A tool to help manage a toolset that helps manage your deployments.

tfct

A tool to help manage a toolset that helps manage your deployments.

Installation

Details on how to install tfct.

Configuration

Details on how to configure tfct.

Commands

Details on each of the commands available in tfct.

Usage

tfct [OPTIONS] <COMMAND>

Global Options

ShortLongDescription
-h--helpPrints help information.
-V--versionPrints version information.
--org <ORG>The name organization to use.
--token <TOKEN>The token to use for authentication.
--project-id <PROJECT_ID>The ID of the project to use.
--log <LOG>The log level to use.
--output <OUTPUT>The location where output should be written.
--start-page <START_PAGE>The page to start at when retrieving data.
--page-size <PAGE_SIZE>The number of items to retrieve per page.
--max-pages <MAX_PAGES>The maximum number of pages to retrieve.
--save-outputSave the output of the command to a file.
--pretty-outputPretty print the output when saving to a file.
--query-name <QUERY_NAME>The name of the workspace to fuzzy search for.
--query-wildcard-name <QUERY_WILDCARD_NAME>The name of the workspace to wildcard search for.
--query-variable <QUERY_VARIABLE>The name of the variable to search for, formatted as key:operator:value.
--query-tag <QUERY_TAG>The name of the tag to search for, formatted as operator:name.

Installation

You can find the latest binaries for Linux, macOS, and Windows on the releases page.

Via Homebrew

brew install 06chaynes/homebrew-tfct/tfct

Via Cargo

cargo install tfct

Via Shell Script

Where <version> is the version you want to install, e.g. v0.1.0.

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/06chaynes/tfc-toolset/releases/download/tfct/<version>/tfct-installer.sh | sh

Via Powershell Script

Where <version> is the version you want to install, e.g. v0.1.0.

irm https://github.com/06chaynes/tfc-toolset/releases/download/tfct/<version>/tfct-installer.ps1 | iex

Configuration

tfct is configured using either a configuration file or via cli arguments.

TOML configuration file

The configuration file is a TOML file that can contain the following properties:

token = "tfc-access-token" # The Terraform Cloud API token to use when making requests.
org = "org-name" # The Terraform Cloud organization to use when making requests.
project = "project-id" # The project to use when making requests.
output = "production.json" # The location where report output should be written
save_output = true # Whether to save the report output of commands to the `output` location.
log = "info" # The log level to use when logging messages. Valid values are `trace`, `debug`, `info`, `warn`, and `error`.

[workspaces.query]
name = "aws-" # The name of the workspace to fuzzy search for
wildcard_name = "*-prod" # The wildcard name of the workspace to search for

[[workspaces.query.tags]] # The tag to search for, formatted as operator:name
operator = "NotContains"
name = "team:"

[[workspaces.query.variables]] # The variable to search for, formatted as key:operator:value
key = "mode"
operator = "Contains"
value = "prod"

[pagination]
start_page = "1" # The page to start at when retrieving data with default of `1` (first page)
max_depth = "1" # The maximum number of pages to retrieve with default of `1` (first page only), 0 for all
page_size = "20" # The number of items to retrieve per page with default of `20` (20 items per page)

CLI arguments

tfct can also be configured using cli arguments. The cli arguments are the similar as the properties in the configuration file, but are prefixed with -- and use kebab-case instead of snake_case. For example, the save_output property in the configuration file would be --save-output as a cli argument.

--org <ORG>
  The name of the organization

--token <TOKEN>
  The token to use for authentication

--project <PROJECT>
  The id of the project

--log <LOG>
  The log level to use

--output <OUTPUT>
  The location where report output should be written

--start-page <START_PAGE>
  The page to start at when retrieving data

--max-pages <MAX_PAGES>
  The maximum number of pages to retrieve

--page-size <PAGE_SIZE>
  The number of items to retrieve per page

--save-output
  Save the output of the command to a file

--pretty-output
  Pretty print the output when saving to a file

--query-name <QUERY_NAME>
  The name of the workspace to fuzzy search for

--query-wildcard-name <QUERY_WILDCARD_NAME>
  The name of the workspace to wildcard search for

--query-variable <QUERY_VARIABLE>
  The name of the variable to search for, formatted as key:operator:value

--query-tag <QUERY_TAG>
  The name of the tag to search for, formatted as operator:name

Valid Operators

The valid operators to use in the toml configuration file are:

  • Contains
  • NotContains
  • Equals
  • NotEquals

The valid operators to use in the cli arguments are:

  • ~= for Contains
  • !~= for NotContains
  • == for Equals
  • != for NotEquals

For more information on filtering see Filtering.

Filtering

Query Filters

Filters can be combined as needed. The current run order for filter logic is:

  1. Name
  2. Wildcard Name
  3. Tags
  4. Variables

Variable Filters

First let's take a look at an example variable filter setup.

[query]
name = "aws-"
wildcard_name = "*-prod"

[[query.variables]]
key = "mode"
operator = "Contains"
value = "prod"

[[query.variables]]
key = "status"
operator = "NotEqual"
value = "migrating"

In this example we will first have an initial name filter, fuzzy searching for workspaces with a name matching aws-. We also have a wildcard name filter, looking for workspaces with a name ending with -prod. We then add two variable filters to our query. The first filter will require that the workspace has a variable with a key of mode and a value containing the string prod. The second filter will check the variable with the key of status, should it exist, and verify that it does not exactly equal migrating. So our resulting dataset would contain only those workspaces starting the with the name aws-, containing the string prod in the mode key, and will not have a status of migrating should the key exist.

Tag Filters

Tag filter logic works very similar to variable filter logic and runs before the variable filter. Let's take a look at an example tag filter setup.

[query]

[[query.tags]]
operator = "NotContains"
name = "team:"

In this example we will not set a name filter, notice how the [query] table is defined but empty. We have one tag filter set which will look at the tags for each workspace in our initial query (since we didn't set any additional filter parameters this would be the first page of workspaces containing up to 20 entries, using the default pagination settings) and will remove any workspace from the results that do not have a tag that contains team:.

Operators

Currently the available "operators" are:

  • Equals
    • A variable with the specified key must exist, and must exactly equal the specified value
    • A tag must exist with a name that exactly equals the specified value
  • NotEquals
    • Should a variable with the specified key exist it must not exactly equal the specified value
    • A tag must not exist with a name that exactly equals the specified value
  • Contains
    • A variable with the specified key must exist, and must contain the specified value
    • A tag must exist with a name that contains the specified value
  • NotContains
    • Should a variable with the specified key exist it must not contain the specified value
    • A tag must not exist with a name that contains the specified value

Commands

workspace

Manage workspaces.

variable

Manage workspace variables.

variable-set

Manage variable sets.

tag

Manage workspace tags.

run

Manage workspace runs.

clean

Run cleanup operations.

help

Prints help message for a command.

Global Options

ShortLongDescription
-h--helpPrints help information.
-V--versionPrints version information.
--org <ORG>The name organization to use.
--token <TOKEN>The token to use for authentication.
--project-id <PROJECT_ID>The ID of the project to use.
--log <LOG>The log level to use.
--output <OUTPUT>The location where output should be written.
--start-page <START_PAGE>The page to start at when retrieving data.
--page-size <PAGE_SIZE>The number of items to retrieve per page.
--max-pages <MAX_PAGES>The maximum number of pages to retrieve.
--save-outputSave the output of the command to a file.
--pretty-outputPretty print the output when saving to a file.
--query-name <QUERY_NAME>The name of the workspace to fuzzy search for.
--query-wildcard-name <QUERY_WILDCARD_NAME>The name of the workspace to wildcard search for.
--query-variable <QUERY_VARIABLE>The name of the variable to search for, formatted as key:operator:value.
--query-tag <QUERY_TAG>The name of the tag to search for, formatted as operator:name.

workspace

Description

Manage workspaces.

Usage

tfct workspace [command] [options]

Subcommands

NameDescription
createCreate a workspace.
updateUpdate a workspace.
deleteDelete a workspace.
listList workspaces.
showShow details of a workspace.
helpPrints help information.

create

Description

Create a workspace.

Usage

tfct workspace create [options]

Options

ShortLongDescription
--name <NAME>The name of the workspace.
--description <DESC>A description for the workspace.
--file-triggers-enabled <FILE_TRIGGERS_ENABLED>Whether to filter runs based on the changed files in a VCS push [possible values: true, false]
--trigger-prefixes <TRIGGER_PREFIXES>A list of trigger prefixes that describe the paths Terraform Cloud monitors for changes, in addition to the working directory
--vcs-branch <VCS_BRANCH>The repository branch that Terraform will execute from
--vcs-identifier <VCS_IDENTIFIER>A reference to your VCS repository in the format :org/:repo where :org and :repo refer to the organization and repository in your VCS provider
--vcs-ingress-submodules <VCS_INGRESS_SUBMODULES>Whether to fetch submodules for a VCS repository [possible values: true, false]
--vcs-oauth-token-id <VCS_OAUTH_TOKEN_ID>The VCS Connection (OAuth Connection + Token) to use
--vcs-tags-regex <VCS_TAGS_REGEX>A regular expression used to match Git tags
--terraform-version <TERRAFORM_VERSION>The version of Terraform to use for this workspace
--execution-mode <EXECUTION_MODE>Which execution mode to use for the workspace. Valid values are remote, local, and agent
--auto-apply <AUTO_APPLY>Whether to automatically apply changes when a Terraform plan is successful [possible values: true, false]
--speculative-enabled <SPECULATIVE_ENABLED>Whether this workspace allows automatic speculative plans [possible values: true, false]
--source-url <SOURCE_URL>A URL identifying the application or client creating this workspace
--source-name <SOURCE_NAME>A friendly name for the application or client creating this workspace [default: tfc-toolset]
--queue-all-runs <QUEUE_ALL_RUNS>Whether runs should be queued immediately after workspace creation [possible values: true, false]
--allow-destroy-plan <ALLOW_DESTROY_PLAN>Whether destroy plans can be queued on this workspace [possible values: true, false]
--auto-destroy-at <AUTO_DESTROY_AT>Timestamp (in RFC3339 format) when the next scheduled destroy run will occur
--assessments-enabled <ASSESSMENTS_ENABLED>Whether or not Terraform Cloud performs health assessments for the workspace [possible values: true, false]
--global-remote-state <GLOBAL_REMOTE_STATE>Whether the workspace should allow all workspaces in the organization to access its state data during runs [possible values: true, false]
--tags-regex <TAGS_REGEX>A regular expression used to match Git tags
--trigger-patterns <TRIGGER_PATTERNS>A list of glob patterns that describe the files Terraform Cloud monitors for changes
--working-directory <WORKING_DIRECTORY>A relative path that Terraform will execute within
--agent-pool-id <AGENT_POOL_ID>The ID of the agent pool belonging to the workspace's organization

Examples

Create a workspace

tfct workspace create --name "my-workspace" --description "My Workspace description" --vcs-identifier "my-org/my-repo" --vcs-branch "main" --vcs-oauth-token-id "ot-id"

update

Description

Update a workspace.

Usage

tfct workspace update [options]

Options

ShortLongDescription
-w--workspace-name <WORKSPACE_NAME>The name of the workspace to update.
-i--workspace-id <WORKSPACE_ID>The ID of the workspace to update.
--name <NAME>The new name of the workspace.
--description <DESC>A description for the workspace.
--file-triggers-enabled <FILE_TRIGGERS_ENABLED>Whether to filter runs based on the changed files in a VCS push [possible values: true, false]
--trigger-prefixes <TRIGGER_PREFIXES>A list of trigger prefixes that describe the paths Terraform Cloud monitors for changes, in addition to the working directory
--vcs-branch <VCS_BRANCH>The repository branch that Terraform will execute from
--vcs-identifier <VCS_IDENTIFIER>A reference to your VCS repository in the format :org/:repo where :org and :repo refer to the organization and repository in your VCS provider
--vcs-ingress-submodules <VCS_INGRESS_SUBMODULES>Whether to fetch submodules for a VCS repository [possible values: true, false]
--vcs-oauth-token-id <VCS_OAUTH_TOKEN_ID>The VCS Connection (OAuth Connection + Token) to use
--vcs-tags-regex <VCS_TAGS_REGEX>A regular expression used to match Git tags
--terraform-version <TERRAFORM_VERSION>The version of Terraform to use for this workspace
--execution-mode <EXECUTION_MODE>Which execution mode to use for the workspace. Valid values are remote, local, and agent
--auto-apply <AUTO_APPLY>Whether to automatically apply changes when a Terraform plan is successful [possible values: true, false]
--speculative-enabled <SPECULATIVE_ENABLED>Whether this workspace allows automatic speculative plans [possible values: true, false]
--source-url <SOURCE_URL>A URL identifying the application or client creating this workspace
--source-name <SOURCE_NAME>A friendly name for the application or client creating this workspace [default: tfc-toolset]
--queue-all-runs <QUEUE_ALL_RUNS>Whether runs should be queued immediately after workspace creation [possible values: true, false]
--allow-destroy-plan <ALLOW_DESTROY_PLAN>Whether destroy plans can be queued on this workspace [possible values: true, false]
--auto-destroy-at <AUTO_DESTROY_AT>Timestamp (in RFC3339 format) when the next scheduled destroy run will occur
--assessments-enabled <ASSESSMENTS_ENABLED>Whether or not Terraform Cloud performs health assessments for the workspace [possible values: true, false]
--global-remote-state <GLOBAL_REMOTE_STATE>Whether the workspace should allow all workspaces in the organization to access its state data during runs [possible values: true, false]
--tags-regex <TAGS_REGEX>A regular expression used to match Git tags
--trigger-patterns <TRIGGER_PATTERNS>A list of glob patterns that describe the files Terraform Cloud monitors for changes
--working-directory <WORKING_DIRECTORY>A relative path that Terraform will execute within
--agent-pool-id <AGENT_POOL_ID>The ID of the agent pool belonging to the workspace's organization

Examples

Create a workspace

tfct workspace update --workspace-name "my-workspace" --description "My New Workspace description"

delete

Description

Delete a workspace.

Usage

tfct workspace delete [options]

Options

ShortLongDescription
-w--workspace-name <WORKSPACE_NAME>The name of the workspace to show.
-i--workspace-id <WORKSPACE_ID>The id of the workspace to show.
-s--safeDelete an existing workspace, but only if it is not managing resources.

Examples

Delete a workspace

tfct workspace delete --workspace-name "my-workspace"

list

Description

List workspaces.

Usage

tfct workspace list [options]

Options

ShortLongDescription
-f--filterFilter the list of workspaces by given criteria.

Examples

List all workspaces

tfct workspace list
tfct workspace list -f --query-wildcard-name "my-*"

List all workspaces and save output to a file

tfct workspace list --save-output --output workspaces.json

show

Description

Show details of a workspace.

Usage

tfct workspace show [options]

Options

ShortLongDescription
-w--workspace-name <WORKSPACE_NAME>The name of the workspace to show.
-i--workspace-id <WORKSPACE_ID>The id of the workspace to show.

Examples

Show a workspace

tfct workspace show --workspace-name "my-workspace"

variable

Description

Manage workspace variables.

Usage

tfct variable [command] [options]

Global Options

ShortLongDescription
-w--workspace-name <WORKSPACE_NAME>The name of the workspace to add the tag to.
-i--workspace-id <WORKSPACE_ID>The id of the workspace to add the tag to.
-f--workspace-file <WORKSPACE_FILE>The file containing a list of workspace names or IDs.
-a--auto-discover-workspacesAutomatically discover workspaces given the specified filters.

Subcommands

NameDescription
createCreate variables on a workspace.
deleteDelete variables from a workspace.
listList variables for a workspace.
helpPrints help information.

create

Description

Create variables on a workspace.

Usage

tfct variable create [options]

Options

ShortLongDescription
-v--var <VAR>The variable to create on the workspace, in the format of 'key=value:description:category:hcl:sensitive'.
--var-file <VAR_FILE>The file containing variables.

Examples

Create a variable on a workspace

tfct variable create --workspace-name "my-workspace" --var "SECRET_KEY=mysecretohno:ENV var for the secret:env:false:true"
tfct variable create --workspace--name "my-workspace" --var "newthing=vale::::true"
tfct variable create --workspace-name "my-workspace" --var "emptyvar="

Create a variable on a workspace using a file

{
  "variables": [
    {
      "var": "SECRET_KEY=mysecretohno:ENV var for the secret:env:false:true"
    },
    {
      "var": "newthing=vale::::true"
    }
  ]
}
tfct variable create --workspace-id "ws-id" --var-file vars.json

delete

Description

Delete variables from a workspace.

Usage

tfct variable delete [options]

Options

ShortLongDescription
-k--var-key <VAR_KEY>The key of the variable to delete from the workspace.
-v--var-id <VAR_ID>The id of the variable to delete from the workspace.
--var-file <VAR_FILE>The file containing variables.

Examples

Delete a variable from a workspace

tfct variable delete --workspace-name "my-workspace" --var-key "SECRET_KEY"
tfct variable delete --workspace--name "my-workspace" --var-id "var-id"

Delete a variable from a workspace using a file

{
  "variables": [
    {
      "var": "SECRET_KEY=mysecretohno:ENV var for the secret:env:false:true"
    },
    {
      "var": "newthing=vale::::true"
    }
  ]
}
tfct variable delete --workspace-id "ws-id" --var-file vars.json

list

Description

List the variables for a workspace.

Usage

tfct variable list [options]

Examples

List the variables for a workspace

tfct variable list --workspace-name "my-workspace"

List the variables for a workspace and save output to a file

tfct variable list --workspace-id "ws-id" --save-output --output variables.json

variable-set

Description

Manage variable sets.

Usage

tfct variable-set [command] [options]

Global Options

ShortLongDescription
-w--workspace-name <WORKSPACE_NAME>The name of the workspace to add the tag to.
-i--workspace-id <WORKSPACE_ID>The id of the workspace to add the tag to.
-f--workspace-file <WORKSPACE_FILE>The file containing a list of workspace names or IDs.
-a--auto-discover-workspacesAutomatically discover workspaces given the specified filters.

Subcommands

NameDescription
applyApply a workspace to a variable set.
removeRemove a workspace from a variable set.
helpPrints help information.

apply

Description

Apply a workspace to a variable set.

Usage

tfct variable-set apply [options]

Options

ShortLongDescription
-v--var-set-id <VAR_SET_ID>The ID of the variable set.

Examples

Apply a workspace to a variable set

tfct variable-set apply --workspace-name "my-workspace" -v "varset-id"

remove

Description

Remove a workspace from a variable set.

Usage

tfct variable-set remove [options]

Options

ShortLongDescription
-v--var-set-id <VAR_SET_ID>The ID of the variable set.

Examples

Remove a workspace to a variable set

tfct variable-set remove --workspace-name "my-workspace" -v "varset-id"

tag

Description

Manage workspace tags.

Usage

tfct tag [command] [options]

Global Options

ShortLongDescription
-w--workspace-name <WORKSPACE_NAME>The name of the workspace to add the tag to.
-i--workspace-id <WORKSPACE_ID>The id of the workspace to add the tag to.
-f--workspace-file <WORKSPACE_FILE>The file containing a list of workspace names or IDs.
-a--auto-discover-workspacesAutomatically discover workspaces given the specified filters.

Subcommands

NameDescription
addAdd tags to a workspace.
removeRemove tags from a workspace.
listList tags for a workspace.
helpPrints help information.

add

Description

Add tags to a workspace.

Usage

tfct tag add [options]

Options

ShortLongDescription
-n--name <NAME>The name of the tag to add.
--tag-file <TAG_FILE>The file containing a list of tags to add.

Examples

Add a tag to a workspace

tfct tag add --workspace-name "my-workspace" --name my-tag

Add a tag to a workspace using a file

{
  "tags": [
    {
      "name": "it:worked"
    }
  ]
}
tfct tag add --workspace-id "ws-id" --tag-file tags.json

remove

Description

Remove tags from a workspace.

Usage

tfct tag remove [options]

Options

ShortLongDescription
-n--name <NAME>The name of the tag to remove.
--tag-file <TAG_FILE>The file containing a list of tags to remove.

Examples

Remove a tag to a workspace

tfct tag remove --workspace-name "my-workspace" --name my-tag

Remove a tag to a workspace using a file

{
  "tags": [
    {
      "name": "it:worked"
    }
  ]
}
tfct tag remove --workspace-id "ws-id" --tag-file tags.json

list

Description

List the tags for a workspace.

Usage

tfct tag list [options]

Examples

List the tags for a workspace

tfct tag list --workspace-name "my-workspace"

List the tags for a workspace and save output to a file

tfct tag list --workspace-name "my-workspace" --save-output --output tags.json

run

Description

Manage runs.

Usage

tfct run [command] [options]

Subcommands

NameDescription
statusGet the status of a run.
specQueue up speculative runs.
planQueue up plan and apply runs.
cancelCancel a run.
discardDiscard a run.
helpPrints help information.

status

Description

Get the status of a run

Usage

tfct run status [options]

Options

ShortLongDescription
-i--run-id <RUN_ID>The id of the run.

Examples

Get the status of a run

tfct run status --run-id "run-id"

spec

Description

Queue up speculative plan runs.

Usage

tfct run spec [options]

Options

ShortLongDescription
-w--workspace-name <WORKSPACE_NAME>The name of the workspace to create the run on.
-i--workspace-id <WORKSPACE_ID>The id of the workspace to create the run on.
-f--workspace-file <WORKSPACE_FILE>The file containing a list of workspace names or IDs.
-a--auto-discover-workspacesAutomatically discover workspaces given the specified filters.
-q--queue <QUEUE>Execute runs in batches with overridable limits.
--queue-max-concurrent <QUEUE_MAX_CONCURRENT>The maximum number of runs to execute concurrently.
--queue-max-iterations <QUEUE_MAX_ITERATIONS>The maximum number of times to check the status of a run before giving up.
--queue-status-check-sleep-seconds <QUEUE_STATUS_CHECK_SLEEP_SECONDS>The number of seconds to wait between checking the status of a run.
--message <MESSAGE>A message to include with the run [default: "Run created by tfc-toolset"].
--target-addrs <TARGET_ADDRS>A list of resource addresses to target for the run.
--replace-addrs <REPLACE_ADDRS>A list of resource addresses to replace for the run.
--terraform-version <TERRAFORM_VERSION>The version of Terraform to use for this run, overriding the value from settings.

Examples

Create a run on a workspace

tfct run spec --workspace-name "my-workspace"

Create a run on a multiple workspaces with a max concurrency of 2

tfct run spec --workspace-file "workspaces.json" -q --queue-max-concurrent 2

plan

Description

Queue up plan and apply runs.

Usage

tfct run plan [options]

Options

ShortLongDescription
-w--workspace-name <WORKSPACE_NAME>The name of the workspace to create the run on.
-i--workspace-id <WORKSPACE_ID>The id of the workspace to create the run on.
-f--workspace-file <WORKSPACE_FILE>The file containing a list of workspace names or IDs.
-a--auto-discover-workspacesAutomatically discover workspaces given the specified filters.
-q--queue <QUEUE>Execute runs in batches with overridable limits.
--queue-max-concurrent <QUEUE_MAX_CONCURRENT>The maximum number of runs to execute concurrently.
--queue-max-iterations <QUEUE_MAX_ITERATIONS>The maximum number of times to check the status of a run before giving up.
--queue-status-check-sleep-seconds <QUEUE_STATUS_CHECK_SLEEP_SECONDS>The number of seconds to wait between checking the status of a run.
--cancel-on-timeout <CANCEL_ON_TIMEOUT>Whether to cancel the run if it reaches the configured limits [possible values: true, false].
--message <MESSAGE>A message to include with the run [default: "Run created by tfc-toolset"].
--target-addrs <TARGET_ADDRS>A list of resource addresses to target for the run.
--replace-addrs <REPLACE_ADDRS>A list of resource addresses to replace for the run.
--terraform-version <TERRAFORM_VERSION>The version of Terraform to use for this run, overriding the value from settings.
--auto-apply <AUTO_APPLY>Automatically apply the run if the plan is successful [default: false] [possible values: true, false].
--allow-empty-apply <ALLOW_EMPTY_APPLY>Apply the run even when the plan contains no changes [default: false] [possible values: true, false].
--is-destroy <IS_DESTROY>Whether this plan is a destroy plan that will destroy all provisioned resources [default: false] [possible values: true, false].
--refresh-only <REFRESH_ONLY>Whether this run should refresh the state without modifying any resources [default: false] [possible values: true, false].

Examples

Create a run on a workspace

tfct run plan --workspace-name "my-workspace"

Create a run on a multiple workspaces with a max concurrency of 2

tfct run plan --workspace-file "workspaces.json" -q --queue-max-concurrent 2

cancel

Description

Cancel a run

Usage

tfct run cancel [options]

Options

ShortLongDescription
-i--run-id <RUN_ID>The id of the run.

Examples

Cancel a run

tfct run cancel --run-id "run-id"

discard

Description

Discard a run

Usage

tfct run discard [options]

Options

ShortLongDescription
-i--run-id <RUN_ID>The id of the run.

Examples

Discard a run

tfct run discard --run-id "run-id"

clean

Description

Run cleanup operations.

Usage

tfct clean [command] [options]

Subcommands

NameDescription
workspaceRun workspace clean operations.
helpPrints help information.

workspace

Description

Run workspace clean operations

Usage

tfct clean workspace [options]

Options

ShortLongDescription
-w--workspace-name <WORKSPACE_NAME>The name of the workspace to create the run on.
-i--workspace-id <WORKSPACE_ID>The id of the workspace to create the run on.
-f--workspace-file <WORKSPACE_FILE>The file containing a list of workspace names or IDs.
-a--auto-discover-workspacesAutomatically discover workspaces given the specified filters.
-d--dry-run <DRY_RUN>Do not perform any clean operations, only detect issues to be cleaned [default: true] [possible values: true, false].
-u--unlisted-variables <UNLISTED_VARIABLES>Detect/Remove unlisted variables [default: true] [possible values: true, false].
-m--missing-repositories <MISSING_REPOSITORIES>Detect missing vcs repositories [default: false] [possible values: true, false].
--git-dir <GIT_DIR>Override the location to which git repositories are cloned.
--message <MESSAGE>A message to include with the run [default: "Run created by tfc-toolset"].
--target-addrs <TARGET_ADDRS>A list of resource addresses to target for the run.
--replace-addrs <REPLACE_ADDRS>A list of resource addresses to replace for the run.
--terraform-version <TERRAFORM_VERSION>The version of Terraform to use for this run, overriding the value from settings.

Examples

Detect issues in a workspace

tfct clean workspace --workspace-name "my-workspace"

Detect issues in a workspace and save the results to a file

tfct clean workspace --workspace-name "my-workspace" --save-output --output "clean-results.json"

Detect and attempt to fix issues in a workspace

tfct clean workspace --workspace-name "my-workspace" --dry-run false

help

Prints help message for a command

Usage

tfct help
tfct --help (-h)
tfct <COMMAND> help
tfct <COMMAND> <SUBCOMMAND> --help (-h)