Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Terraform Associate All Questions

View all questions & answers for the Terraform Associate exam

Exam Terraform Associate topic 1 question 124 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 124
Topic #: 1
[All Terraform Associate 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?

  • 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
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
KJ_Rollings
Highly Voted 1 year, 6 months ago
Selected Answer: B
B. for v0.15.2 and later, you can also use "terraform apply -replace=ADDRESS" to achieve the same result.
upvoted 8 times
...
keiffo2
Highly Voted 2 years, 2 months ago
terraform apply -target - just looks at applying part of the config. In this case we'd need to taint the resource and then run an apply. Just to note taint is now deprecated - seems like it comes up in the exam mind, instead of using taint you should use terrform apply -replace=aws_instance.my_server
upvoted 5 times
alirasouli
1 year, 11 months ago
Exactly I was thinking about `terraform apply -replace=...`, so answer C can also be correct. Of course answer B is also correct and deprecated!
upvoted 1 times
...
keiffo2
2 years, 2 months ago
So answer B
upvoted 2 times
...
Spandrop
1 year ago
being taint deprecated, I would go with C.
upvoted 3 times
...
...
junk4share
Most Recent 1 year, 4 months ago
Selected Answer: B
ITS B.
upvoted 1 times
...
adouban
1 year, 11 months ago
B correct
upvoted 1 times
...
depal_dhir
2 years, 2 months ago
Selected Answer: B
https://www.terraform.io/cli/state/taint
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...