You've used Terraform to deploy a virtual machine and a database. You want to replace this virtual machine instance with an identical one without affecting the database. What is the best way to achieve this using Terraform?
A.
Use the terraform state rm command to remove the VM from state file
B.
Use the terraform taint command targeting the VMs then run terraform plan and terraform apply
C.
Use the terraform apply command targeting the VM resources only
D.
Delete the Terraform VM resources from your Terraform code then run terraform plan and terraform apply
The terraform taint command marks a resource as tainted, which means it will be destroyed and recreated on the next apply. This way, you can replace the VM instance without affecting the database or other resources. References = [Terraform Taint]
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit