TERRAFORM-ASSOCIATE-003 · Question #70
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…
The correct answer is B. Use the terraform taint command targeting the VMs 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.
Question
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?
Options
- AUse the terraform state rm command to remove the VM from state file
- BUse the terraform taint command targeting the VMs then run terraform plan and terraform apply
- CUse the terraform apply command targeting the VM resources only
- DDelete the Terraform VM resources from your Terraform code then run terraform plan and
How the community answered
(31 responses)- A10% (3)
- B81% (25)
- C6% (2)
- D3% (1)
Explanation
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.
Topics
Community Discussion
No community discussion yet for this question.