learn-terraform

Course outlines for learning terraform.

View the Project on GitHub robertdebock/learn-terraform

Destroy infrastructure

expected time requirements
15 minutes A computer with Terraform installed.

Goal: Learn how to destroy infrastructure.

Explanation

Specifically for tests is quick and simple to spin up new resources like virtual machines, loadbalancers, disks, etc. Once you’re done with testing or developing, it’s time to take the test infrastructure down again.

For production workloads is not common to destroy but rather change the .tf files and run terraform apply again.

Howto

Demo

Assignment

View the results

AWS Console Azure Portal GCP Console

Questions

  1. Now that you know how to destroy all resources defined, how do you destroy only one resource?
  2. Why would you use terraform destroy?
  3. Can you destroy without terraform.tfstate or terraform.tfstate.backup?

Solution

Described in the Howto, specifically here.