Using Terraform CLI, how do you destroy all infrastructure that is present in your Terraform state?
Experience Level: Junior
Tags: Terraform
Answer
There are multiple options:
Option 1:
Run the following command:
terraform apply -destroy
Option 2:
Run the following command:
terraform destroy
Option 3:
Run the following command:
terraform plan -destroy -out=plan.zip
terraform apply plan.zip
Related Terraform job interview questions
How do you approve changes presented by terraform apply command of Terraform CLI?
Terraform JuniorUsing Terraform CLI, how do you apply plan that you previously stored using terraform plan command?
Terraform JuniorUsing Terraform CLI, you want to apply your configuration changes. How do you approve them automatically so that you don't need to confirm by typing yes?
Terraform JuniorWhat happens on Linux-based operating systems when you run terraform plan command and confirm by typing yes?
Terraform JuniorUsing Terraform CLI, how do you create or update infrastructure according to Terraform configuration?
Terraform Junior