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?
Suggested Answer: B
Get Premium Terraform-Associate-004 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
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]
17 comments · newest first
EL
Elenora
30 days ago
Exactly! Plus, it keeps the database intact.
RA
Raelene
1 month ago
Right, B is the safest and most efficient choice.
MA
Maryann
1 month ago
D is not ideal either. Deleting resources feels unsafe.
EL
Elenora
2 months ago
Option C is too simple. It won't guarantee a new VM.
RA
Raelene
2 months ago
True, A might lead to inconsistencies.
MA
Maryann
2 months ago
Option A seems risky. Removing from state could cause issues.
EL
Elenora
2 months ago
I agree, B makes sense. It targets the VM specifically.
RA
Raelene
2 months ago
I think option B is the best. Tainting ensures a fresh instance.
CH
Chanel
2 months ago
Wait, can you really just taint it like that? Sounds too easy!
KR
Kristian
3 months ago
D is just deleting stuff, that can't be the best option, right?
DE
Denise
3 months ago
C sounds too simple, not sure it would work as intended.
LE
Leonie
3 months ago
A seems risky, removing from state could cause issues.
SH
Sherita
3 months ago
I think B is the right choice here. Tainting is the way to go!
AD
Adaline
3 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.
GO
Goldie
3 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.
DE
Delpha
4 months ago
I think option C sounds familiar, but it feels risky to just apply changes without ensuring the database isn't affected.
VE
Venita
4 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.