Exam Terraform Associate All QuestionsBrowse all questions from this exam
Question 48

You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. The shared team account already contains

15 virtual machines (VM). You develop a Terraform configuration containing one VM, perform terraform apply, and see that your VM was created successfully.

What should you do to delete the newly-created VM with Terraform?

    Correct Answer: B

    The Terraform state file only contains the resources that were created or managed using Terraform. In this case, since you only developed a Terraform configuration for one VM, the state file will only have information about that one VM. To delete the newly-created VM, you can execute terraform destroy, which will remove the resources tracked by the state file. The other 15 VMs in the team account, which were likely created outside of Terraform, will not be affected by this operation.

Discussion
habrosOption: B

B. Only resources mentioned in terraform will be applied and reflected in state. Resources manually created in console and/or not defined in code will not be captured by Terraform

wangchungOption: B

The question says " You develop a Terraform configuration containing one VM,"... would that not mean that a different state file therefore the 15 vms would not be registered

wangchung

B still. " A. The Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM. " ---- what does that meant "select the newly-created VM" you can't destroy a single resource, to destroy and recreate a new resource you use terraform taint to mark the resource for deletions and recreation

Jaro3000

You can destroy a single resource using --target But still B as we assume we have a separate state file with our vm only

VANSIOption: B

B easy

oab720Option: B

Don’t worry, you won’t delete prod instances

therealquanOption: B

Definitely B

therealquan

the other existing VMs need to be imported to be affected by the terraform destroy

vibzr2023Option: B

B. The Terraform state file only contains the one new VM. Execute terraform destroy: This is the correct approach. When you create resources with Terraform, it tracks those resources in a state file. Since you've only created one VM with Terraform, only that VM is tracked in the state file. Running terraform destroy will remove all resources tracked in the state file, which in this case, is just the one VM you've created.

vibzr2023

A. The Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM: This option is incorrect because Terraform's state file does not automatically track resources that were not created or imported through Terraform. Since the 15 other VMs in the account were not managed by this Terraform configuration, they will not be in the state file, and terraform destroy will not affect them. C. Delete the Terraform state file and execute Terraform apply: This approach is not recommended. Deleting the state file removes Terraform's knowledge of the resources it manages, but does not actually delete those resources from the cloud provider. Running terraform apply afterwards would attempt to create the resources anew based on the

vibzr2023

D. Delete the VM using the cloud provider console and terraform apply to apply the changes: This option is not advisable because it involves manually deleting a resource outside of Terraform, which can lead to discrepancies between your real infrastructure and Terraform's state. If a resource is manually deleted, Terraform's state file still thinks the resource exists, and running terraform apply would likely result in Terraform trying to "reconcile" the state by re-creating the deleted VM, which is not the intended outcome.

Ni33Option: B

B is the correct answer. Terraform only maintains desired state and not actual state of the infrastructure in the account.

yuvifoseOption: B

Since the other machines are not in Terraform yet, it won't touch them

EltoothOption: B

B is correct answer.

EmpelOption: B

Is B for sure. the state file does not contain information about anything else that you might have on the cloud provider

Molly1994Option: D

B or D ? if you delete the one VM in UI, when you apply, it will refresh the state file, the VM has been deleted.

gofavad926Option: B

B, destroy the created instance

Power123Option: B

B is the answer

FarziWaliMarzi

mostly hypothetically assumed answers, not solid concrete answer here? I somehow feel that its a very poorly framed question.

Network_1Option: B

You created a Terraform configuration containing 1 VM... You didn't modify the existing Terraform configuration. Hence, only the config you created would be deleted

pmzoneOption: A

The single Vm can be deleted using -target option in terraform destroy. In this case, I am assuming that the 15 VM's are created using TF.

Ahmad_TerraformOption: A

because its shared ac So A is correct