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.
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, 3 months agowanrltw
Highly Voted 1 year, 7 months agoDaminaij
Most Recent 3 days, 22 hours agodzhang344
2 weeks, 2 days agoMouszie
1 month, 1 week agoEdward2021
1 month, 1 week agoSilentH
2 months, 3 weeks agoRyan1002
3 months, 2 weeks agorecep38
4 months, 2 weeks agovipulchoubisa
6 months agosamimshaikh
6 months, 1 week agoMarch2023
1 year agosdm13168
1 year, 1 month agoFawadK
1 year, 2 months agozanhsieh
1 year, 2 months agocamps
1 year, 3 months agoSilentMilli
1 year, 3 months ago