Using terraform plan command of Terraform CLI, how can you enforce replacing of a specific resource that wasn't changed?

Experience Level: Junior
Tags: Terraform

Answer

Run the following command:

terraform plan -replace=resource

The command above will generate a speculative execution plan that includes replacement of the requested resource. The plan won't be executed unless it's stored to an output file and applied using terraform apply -state=path command.

Comments

No Comments Yet.
Be the first to tell us what you think.
Terraform CLI
Terraform CLI

Are you learning Terraform ? Try our test we designed to help you progress faster.

Test yourself