Back to course

Advanced State Management: Taint & Untaint

Infrastructure as Code (Terraform & OpenTofu Mastery)

Forcing a Rebuild

If a server is 'poisoned' (someone manually messed it up), you can mark it as 'tainted'.

bash tofu taint aws_instance.web

Next time you run apply, OpenTofu will destroy that specific server and recreate it. (Note: In newer versions, we use -replace during apply instead).