Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 30


You have used Terraform to create an ephemeral development environment in the cloud and are now ready to destroy all the infrastructure described by your

Terraform configuration. To be safe, you would like to first see all the infrastructure that will be deleted by Terraform.

Which command should you use to show all of the resources that will be deleted? (Choose two.)

Show Answer
Correct Answer: AD

To see all the infrastructure that will be deleted by Terraform, you can use two commands. The first option is to run 'terraform plan -destroy'. This command will generate a plan that shows all of the changes Terraform will make to the infrastructure, specifically indicating the resources that will be destroyed. The '-destroy' flag specifies that only changes resulting in the destruction of resources will be shown. The second option is to run 'terraform destroy'. This command will output a list of resources that will be destroyed before prompting for approval, giving you a chance to review them before proceeding with the actual destruction.

Discussion

29 comments
Sign in to comment
Ipergorta
Oct 30, 2022

The answer is A,D

ItaloVinodiOptions: AD
Nov 13, 2022

We need to choose two so AD

AzRNoob
Oct 7, 2023

A. Run terraform plan -destroy. This command will generate a plan that shows all of the changes Terraform will make to the infrastructure, including any resources that will be destroyed. The -destroy flag specifies that only the changes that will result in the destruction of resources should be shown. Option D is also partially correct, as running terraform destroy will output a list of resources that will be destroyed before prompting for approval. However, it is generally recommended to run terraform plan -destroy first to preview the changes before actually executing them with terraform destroy. Option B is incorrect, as it is possible to show resources that will be deleted using the terraform plan -destroy command. Option C is also incorrect, as running terraform state rm * will remove all resources from the Terraform state file, effectively "forgetting" about them and making it impossible to manage them with Terraform.

HungDangOptions: AD
Dec 14, 2022

AD is correct

RVivekOptions: AD
Mar 22, 2023

https://www.terraform.io/cli/commands/destroy terraform plan -destroy Copy This will run terraform plan in destroy mode, showing you the proposed destroy changes without executing them C is absurd that will make the deployed resources not managible by Terraform

DerekKey
Jun 3, 2023

A - terraform plan -destroy / No changes. No objects need to be destroyed. -destroy Select the "destroy" planning mode, which creates a plan to destroy all objects currently managed by this Terraform configuration instead of the usual behavior.

Pinky0289
Mar 16, 2023

Tested. Options A and D are correct.

vj_dhaksh
Dec 13, 2023

Answer is AD C - incorrect as running "terraform state rm *" throws error stating variable required (* wont pick all)

Ipergorta
Oct 30, 2022

terraform plan -destroy Select the "destroy" planning mode, which creates a plan to destroy all objects currently managed by this Terraform configuration instead of the usual behavior.

Shane_COptions: AD
Jan 4, 2024

AD are correct

Rikktm
Dec 21, 2022

it's A and D, checked it.

nhatneOptions: AD
Jan 2, 2023

should be A,D

EltoothOptions: AD
Jan 6, 2023

A and D are correct answers.

yuvifoseOptions: AD
Jan 18, 2023

A and D!

cjigOptions: AD
Jan 24, 2023

Answer is A and D

najslejdi
Feb 24, 2023

Usage: terraform destroy [options] This command is just a convenience alias for the following command: terraform apply -destroy For that reason, this command accepts most of the options that terraform apply accepts, although it does not accept a plan file argument and forces the selection of the "destroy" planning mode.

G4ExamsOptions: AD
Apr 30, 2023

The answer is A & D.

vikramvlr
Jun 13, 2023

Correct answer - AD

andersonbispos42Option: A
Jun 27, 2023

The answer is only A

andersonbispos42Options: AD
Jun 27, 2023

The answer is A, D

r1ck
Aug 29, 2023

https://developer.hashicorp.com/terraform/cli/commands/destroy AD

Power123
Sep 30, 2023

A and D are correct

connecttozee
Oct 4, 2023

100% is AD

FaaizzOptions: AD
Oct 4, 2023

A & D are correct here

Bluemoon22
Oct 24, 2023

A is only to show the resources will be destroyed, terraform plan -destroy D is a common operation from terraform destroy

Ni33Options: AD
Nov 1, 2023

A and D are correct.

karendavtyan
Nov 5, 2023

D. Run terraform destroy and it will first output all the resources that will be deleted before prompting for approval.

karendavtyanOption: A
Nov 5, 2023

A. Run terraform plan -destroy.

ravi135
Aug 10, 2024

answer AD