Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam Terraform Associate topic 1 question 142 discussion

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

Which of the following is not a way to trigger terraform destroy?

  • A. Using the destroy command with auto-approve
  • B. Running terraform destroy from the correct directory and then typing "yes" when prompted in the CLI
  • C. Passing --destroy at the end of a plan request
  • D. Delete the state file and run terraform apply
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
lizzard812
Highly Voted 1 year, 3 months ago
The real exam gives options either apply -destroy or delete state file + plan, so obviously plan does not destroy anything, so I went with this. The examtopics question here is misspelled. So you won’t be confused that much on real exam.
upvoted 16 times
...
wanrltw
Highly Voted 1 year, 7 months ago
I'd go with D. The `terraform plan -destroy` command will only show what is going to be destroyed (it’s only a plan). However, removing the state file has nothing to do with `terraform destroy` at all - it would only make Terraform forget about its objects while they continue to exist in the remote system.
upvoted 13 times
...
Daminaij
Most Recent 3 days, 22 hours ago
Plan don’t destroy anything
upvoted 1 times
...
dzhang344
2 weeks, 2 days ago
Selected Answer: C
execute plan doesn't trigger destroy
upvoted 1 times
...
Mouszie
1 month, 1 week ago
will go for D
upvoted 1 times
...
Edward2021
1 month, 1 week ago
"is not a way to do " - ill take A.. you shouldn't do destroy without being sure what you are destroying..
upvoted 1 times
...
SilentH
2 months, 3 weeks ago
Selected Answer: C
Because there is no double-dash destroy (hoping this isn’t a typo)
upvoted 1 times
...
Ryan1002
3 months, 2 weeks ago
Selected Answer: D
Destroy mode: creates a plan whose goal is to destroy all remote objects that currently exist, leaving an empty Terraform state. It is the same as running terraform destroy. Destroy mode can be useful for situations like transient development environments, where the managed objects cease to be useful once the development task is complete. Activate destroy mode using the -destroy command line option.
upvoted 1 times
...
recep38
4 months, 2 weeks ago
I tested in a lab. When you run "terraform plan -destroy" it just shows which resource will be destroyed but didnt destroy anything. If you want to destroy you should run "terraform destroy". But interestingly When you delete state file and run "terraform apply" command it creates a new resources not destroy. It seems two options are correct. C and D.
upvoted 2 times
...
vipulchoubisa
6 months ago
delete state file is never suggested by terraform so simple, answer is D.
upvoted 1 times
...
samimshaikh
6 months, 1 week ago
Selected Answer: C
Answer is C because there is no such command to trigger a destroy "terrafrom destroy --destroy" A & B are way to trigger a destroy. D: will not suite because in the question it has mentioned that "way of triggering a destroy" instead of "way of destroy"
upvoted 1 times
...
March2023
1 year ago
Selected Answer: D
im going with D
upvoted 1 times
...
sdm13168
1 year, 1 month ago
Selected Answer: D
D, if you delete the state file, then run terraform apply, terraform will try to create the whole infrastructure but get error.
upvoted 1 times
...
FawadK
1 year, 2 months ago
Selected Answer: D
D makes more sense than C. Correct answer should be D
upvoted 1 times
...
zanhsieh
1 year, 2 months ago
Selected Answer: D
D. C: Wrong. "Destroy mode: creates a plan whose goal is to destroy all remote objects that currently exist, leaving an empty Terraform state. It is the same as running terraform destroy." https://developer.hashicorp.com/terraform/cli/commands/plan#planning-modes
upvoted 2 times
...
camps
1 year, 3 months ago
Selected Answer: C
C. Passing --destroy at the end of a plan request. The terraform destroy command is used to destroy the infrastructure resources created by Terraform according to the current configuration. Option D is incorrect because deleting the state file and running terraform apply will not trigger terraform destroy. Running terraform apply with no changes to the Terraform configuration will have no effect on the existing infrastructure resources, and will not destroy them. If you delete the state file and then run terraform apply, Terraform will not know about any existing infrastructure resources, and will attempt to create new resources according to the current configuration. This may lead to unexpected results and is not a recommended approach to managing infrastructure with Terraform.
upvoted 2 times
...
SilentMilli
1 year, 3 months ago
Selected Answer: D
terraform apply is a command that creates or updates resources as described in the Terraform configuration. Deleting the state file and running terraform apply will cause Terraform to create resources that are missing, rather than destroying them.
upvoted 1 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 ...
ex Want to SAVE BIG on Certification Exam Prep?
close
ex Unlock All Exams with ExamTopics Pro 75% Off
  • arrow Choose From 1000+ Exams
  • arrow Access to 10 Exams per Month
  • arrow PDF Format Available
  • arrow Inline Discussions
  • arrow No Captcha/Robot Checks
Limited Time Offer
Ends in