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
Raelene
4 days ago
True, A might lead to inconsistencies.
upvoted 0 times
...
Maryann
10 days ago
Option A seems risky. Removing from state could cause issues.
upvoted 0 times
...
Elenora
15 days ago
I agree, B makes sense. It targets the VM specifically.
upvoted 0 times
...
Raelene
20 days ago
I think option B is the best. Tainting ensures a fresh instance.
upvoted 0 times
...
Chanel
25 days ago
Wait, can you really just taint it like that? Sounds too easy!
upvoted 0 times
...
Kristian
1 month ago
D is just deleting stuff, that can't be the best option, right?
upvoted 0 times
...
Denise
1 month ago
C sounds too simple, not sure it would work as intended.
upvoted 0 times
...
Leonie
1 month ago
A seems risky, removing from state could cause issues.
upvoted 0 times
...
Sherita
2 months ago
I think B is the right choice here. Tainting is the way to go!
upvoted 0 times
...
Adaline
2 months 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
2 months 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
2 months 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
2 months 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