Julio Jimenez
Essential DevOps

Essential DevOps

Replacing Terraform Resources

Replacing Terraform Resources

Julio Jimenez's photo
Julio Jimenez

Published on Nov 5, 2021

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Prior to Terraform 0.15.2, to replace a resource, one would have to use the terraform taint [options] address command.

Here's what the docs say about taint.

The terraform taint command informs Terraform that a particular object has become degraded or damaged. Terraform represents this by marking the object as "tainted" in the Terraform state, in which case Terraform will propose to replace it in the next plan you create.

You ain't gotta taint no mo'

If all you want to do is replace an object, and you do not have any configuration changes to make, a forced replacement can be accomplished with the terraform apply -replace="resource_address" command.

Again, this option is only available in Terraform >0.15.2.

That's it. Go be essential.

 
Share this