Cleaning up and destroying infrastructure resources
After completing the hands-on exercises in this chapter, you can follow the instructions in this section to destroy the Kubernetes cluster and its AWS resources.
You will destroy the resources in reverse order from their creation. First, you will destroy the Kubernetes cluster resources, then the VPC resources, and finally the shared state resources.
Destroying the cluster resources
Follow these Terraform commands to destroy all of the packtclusters
resources that you created in the previous sections of this chapter:
- Initialize the Terraform state:
$ cd Chapter03/terraform/packtclusters $ terraform init
- Execute the
terraform destroy
command. Enteryes
when you get a prompt to approve the destruction:$ terraform destroy
- You will get the following output once the
terraform destroy
command completes successfully. This means that Terraform has successfully destroyed the 22 resources in the cluster:
...