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.
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.
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.
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.
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.
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"
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
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.
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.
D. Delete the state file and run terraform apply is not a way to trigger terraform destroy.
The other options listed are valid ways to trigger the terraform destroy command:
A. Using the terraform destroy command with the auto-approve option: terraform destroy -auto-approve
B. Running terraform destroy from the correct directory and then typing "yes" when prompted in the CLI: terraform destroy followed by typing "yes"
C. Passing --destroy at the end of a plan request: terraform plan --destroy
However, deleting the state file and running terraform apply is not a correct way to trigger terraform destroy. terraform apply is used to create or update infrastructure resources, whereas terraform destroy is used to destroy resources. If the state file is deleted and terraform apply is run, it will create resources instead of destroying them.
A y B are correct. C is not a way to run a destroy because it only show the plan. D is not related with a destroy so D is true too. C is the correct answer
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.
lizzard812
Highly Voted 1 year agowanrltw
Highly Voted 1 year, 4 months agoSilentH
Most Recent 1 week, 1 day agoRyan1002
1 month agorecep38
2 months agovipulchoubisa
3 months, 2 weeks agosamimshaikh
3 months, 4 weeks agoMarch2023
10 months, 2 weeks agosdm13168
11 months, 1 week agoFawadK
11 months, 3 weeks agozanhsieh
11 months, 3 weeks agocamps
1 year agoSilentMilli
1 year, 1 month agoManguu
1 year, 1 month agopyro7
1 year, 2 months agoArrash
1 year, 2 months agoagmesas
1 year, 2 months ago