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 (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
KJ_Rollings
Highly Voted 7 months, 2 weeks 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 1 year, 3 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
Spandrop
1 month, 2 weeks ago
being taint deprecated, I would go with C.
upvoted 3 times
...
keiffo2
1 year, 3 months ago
So answer B
upvoted 2 times
...
alirasouli
1 year 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
...
...
junk4share
Most Recent 5 months, 2 weeks ago
Selected Answer: B
ITS B.
upvoted 1 times
...
adouban
1 year ago
B correct
upvoted 1 times
...
depal_dhir
1 year, 3 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago