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 174 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 174
Topic #: 1
[All Terraform Associate Questions]

You have a Terraform configuration that defines a single virtual machine with no references to it. You have run terraform apply to create the resource, and then removed the resource definition from your Terraform configuration file.
What will happen when you run terraform apply in the working directory again?

  • A. Nothing
  • B. Terraform will destroy the virtual machine
  • C. Terraform will error
  • D. Terraform will remove the virtual machine from the state file, but the resource will still exist
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
Nick_001
1 year, 8 months ago
Selected Answer: B
tested in lab. When reference to resource is removed in config file the next "terraform apply" will destroy the resource. Below is the output from cli # aws_instance.name will be destroyed # (because aws_instance.name is not in configuration)
upvoted 3 times
...
dokaedu
2 years, 1 month ago
The question is saying removing resource definition of the resource, NOT removing the resource (VM)
upvoted 2 times
...
dokaedu
2 years, 1 month ago
The question is saying removing the description of the resource, NOT removing the resource (VM)
upvoted 2 times
dnscloud02
2 years, 1 month ago
definition not description
upvoted 3 times
...
...
depal_dhir
2 years, 2 months ago
Selected Answer: B
This will destroy the VM
upvoted 4 times
...
keiffo2
2 years, 2 months ago
If you remove the resource from your config file and the resource is in your state file, terraform will apply the configuration in the config file - which is to delete the resource
upvoted 4 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 ...