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
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
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.
KJ_Rollings
Highly Voted 1 year, 6 months agokeiffo2
Highly Voted 2 years, 2 months agoalirasouli
1 year, 11 months agokeiffo2
2 years, 2 months agoSpandrop
1 year agojunk4share
Most Recent 1 year, 4 months agoadouban
1 year, 11 months agodepal_dhir
2 years, 2 months ago