Terraform Taint, Untaint, Replace – How to Use It (Examples)
In this post, we explore how the CLI commands – taint, untaint, and replace – help address issues with Terraform-managed cloud resources. We create two EC2 instances using Terraform and demonstrate how to use these commands to replace a misconfigured resource with a new instance. The taint command marks a resource as tainted so that it will be replaced in the next apply cycle, while the untaint command removes this mark if it was a mistake. Starting from Terraform version 0.15.2, the taint command is deprecated and it is suggested to use apply command with the -replace flag instead. This approach eliminates the time between marking the resource as tainted and applying those changes, thus avoiding unintentional replacements in a shared development environment.
Company
Spacelift
Date published
Aug. 8, 2022
Author(s)
Sumeet Ninawe
Word count
2014
Language
English
Hacker News points
2