Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 142


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

Show Answer
Correct Answer: D

Deleting the state file and running terraform apply will not trigger Terraform destroy. When you delete the state file, Terraform loses track of the existing infrastructure but does not destroy it. Instead, running terraform apply under these conditions would likely lead Terraform to attempt to recreate all resources based on the current configuration, potentially leading to unexpected results. This is not a method for triggering a destroy operation.

Discussion

17 comments
Sign in to comment
lizzard812Option: C
Apr 3, 2023

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.

wanrltwOption: D
Dec 10, 2022

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.

campsOption: C
Mar 31, 2023

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.

zanhsiehOption: D
May 4, 2023

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

recep38Option: C
Feb 24, 2024

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.

FawadKOption: D
May 9, 2023

D makes more sense than C. Correct answer should be D

sdm13168Option: D
May 18, 2023

D, if you delete the state file, then run terraform apply, terraform will try to create the whole infrastructure but get error.

March2023Option: D
Jun 13, 2023

im going with D

samimshaikhOption: C
Dec 29, 2023

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"

vipulchoubisaOption: D
Jan 8, 2024

delete state file is never suggested by terraform so simple, answer is D.

Ryan1002Option: D
Mar 20, 2024

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.

SilentHOption: C
Apr 17, 2024

Because there is no double-dash destroy (hoping this isn’t a typo)

Edward2021Option: A
May 28, 2024

"is not a way to do " - ill take A.. you shouldn't do destroy without being sure what you are destroying..

MouszieOption: D
May 30, 2024

will go for D

dzhang344Option: C
Jun 21, 2024

execute plan doesn't trigger destroy

DaminaijOption: C
Jul 4, 2024

Plan don’t destroy anything

090200fOption: D
Jul 18, 2024

option D is correct answer