Terraform
- Terraform Enterprise
- 1.0.x (latest)
- v202507-1
- v202506-1
- v202505-1
- v202504-1
- v202503-1
- v202502-2
- v202502-1
- v202501-1
- v202411-2
- v202411-1
- v202410-1
- v202409-3
- v202409-2
- v202409-1
- No versions of this document exist before v202408-1. Click below to redirect to the version homepage.
- v202408-1
- v202407-1
- v202406-1
- v202405-1
- v202404-2
- v202404-1
- v202402-2
- v202402-1
- v202401-2
- v202401-1
- v202312-1
- v202311-1
- v202310-1
- v202309-1
- v202308-1
- v202307-1
- v202306-1
- v202305-2
- v202305-1
- v202304-1
- v202303-1
- v202302-1
- v202301-1
- v202212-2
- v202212-1
- v202211-1
- v202210-1
- v202209-2
- v202209-1
- v202208-3
- v202208-2
- v202208-1
- v202207-2
- v202207-1
- v202206-1
Run Modes and Options
Terraform Cloud runs support many of the same modes and options available in the Terraform CLI.
Destroy Mode
Destroy mode instructs Terraform to create a plan which destroys all objects, regardless of configuration changes.
- CLI: Use terraform plan -destroyorterraform destroy
- API: Use the is-destroyoption.
- UI: Use a workspace's Destruction and Deletion settings page.
Refresh-Only Mode
Hands-on: Try the Use Refresh-Only Mode to Sync Terraform State tutorial.
Version note: Refresh-only support requires a workspace using at least Terraform CLI v0.15.4.
Refresh-only mode instructs Terraform to create a plan which updates the Terraform state to match changes made to remote objects outside of Terraform.
- CLI: Use terraform plan -refresh-onlyorterraform apply -refresh-only.
- API: Use the refresh-onlyoption.
- UI: Use the "Start new plan" action from a workspace's "Actions" menu, then choose the "Refresh-only" plan type in the new plan dialog.
Skipping Automatic State Refresh
The -refresh=false option is used in normal planning mode to skip the default behavior of refreshing Terraform state before checking for configuration changes.
- CLI: Use terraform plan -refresh=falseorterraform apply -refresh=false.
- API: Use the refreshoption.
Replacing Selected Resources
Version note: Replace support requires a workspace using at least Terraform CLI v0.15.2.
The replace option instructs Terraform to replace the object with the given resource address.
- CLI: Use terraform plan -replace=ADDRESSorterraform apply -replace=ADDRESS.
- API: Use the replace-addrsoption.
Allow Empty Apply
A no-operation (empty) apply enables Terraform Cloud to apply a run from a plan that contains no infrastructure changes. During apply, Terraform can upgrade the state version if required. You can use this option to upgrade the state in your Terraform Cloud workspace to a new Terraform version.
Warning: Terraform Cloud cannot guarantee that a plan in this mode will produce no changes. We recommend checking the plan for drift before proceeding to the apply stage.
- API: Set the allow-empty-applyfield totrue.
- UI: Open the workspace's Actions menu, select Start new plan, and then choose Allow empty apply as the run type.
Plan Only/Speculative Plan
This option creates a speculative plan. The speculative plan shows a set of possible changes and checks them against Sentinel policies, but Terraform cannot apply it. You can create speculative plans with a Terraform version that is different from the one currently selected for the workspace. This lets you check whether your configuration is compatible with a newer Terraform version without changing the workspace settings.
- API: Set the plan-onlyfield totrueand specify an available terraform version using theterraform-versionfield.
- UI: Open the workspace's Actions menu, select Start new plan, and then choose Plan only as the run type.
Targeted Plan and Apply
Resource Targeting is intended for exceptional circumstances only and should not be used routinely.
- CLI: Use terraform plan -target=ADDRESSorterraform apply -target=ADDRESS.
- API: Use the target-addrsoption.
The usual caveats for targeting in local operations imply some additional limitations on Terraform Cloud features for remote plans created with targeting:
- Sentinel policy checks for targeted plans will see only the selected subset of resource instances planned for changes in the - tfplanimport and the- tfplan/v2import, which may cause an unintended failure for any policy that requires a planned change to a particular resource instance selected by its address.
- Cost Estimation is disabled for any run created with - -targetset, to prevent producing a misleading underestimate of cost due to resource instances being excluded from the plan.
You can disable or constrain use of targeting in a particular workspace using a Sentinel policy based on the tfrun.target_addrs value.