terraform Verified current stable Not installed? Cloud Infrastructure

Terraform / Replace Specific Resource

Replace Specific Resource

Terraform command syntax to replace specific resource. Copyable examples, output expectations, and common mistakes.

$
Terminal
terraform apply -replace <resource_type.resource_name[instance_index]>

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
terraform apply -replace <resource_type.resource_name[instance_index]>

Command Breakdown

What each part is doing

terraform
Base Command
The executable that performs this operation. Here it runs Terraform before the shell applies any redirect operators.
<resource_type.resource_name[instance_index]>
resource type.resource name[instance index
The value supplied for resource type.resource name[instance index.
-replace
Command Option
Tool-specific option used by this command invocation.

Alternative Approaches

Comparable commands in other tools

Alternative cloud infrastructure tools for the same job.