Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

HashiCorp Terraform-Associate-004 Exam - Topic 3 Question 11 Discussion

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?
B) Use the terraform taint command targeting the VMs then run terraform plan and terraform apply
A) Use the terraform state rm command to remove the VM from state file
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

HashiCorp Terraform-Associate-004 Exam - Topic 3 Question 11 Discussion

Actual exam question for HashiCorp's Terraform-Associate-004 exam
Question #: 11
Topic #: 3
[All Terraform-Associate-004 Questions]

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?

Show Suggested Answer Hide Answer
Suggested Answer: B

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.Reference= [Terraform Taint]


Contribute your Thoughts:

0/2000 characters
Adaline
5 days ago
I feel like deleting the VM resources from the code and applying changes might be too drastic. I need to double-check how that impacts the state.
upvoted 0 times
...
Goldie
10 days ago
I practiced a similar question where we had to manage dependencies, and I think removing the VM from the state file could lead to issues later on.
upvoted 0 times
...
Delpha
15 days ago
I think option C sounds familiar, but it feels risky to just apply changes without ensuring the database isn't affected.
upvoted 0 times
...
Venita
20 days ago
I remember something about using the terraform taint command to mark resources for recreation, but I'm not entirely sure if that's the best option here.
upvoted 0 times
...

Save Cancel