Destroying the Resources
Understand how to use Terraform's destroy commands to remove Google Kubernetes Engine cluster resources without deleting the essential storage of Terraform state, ensuring you can recreate clusters for subsequent exercises. Learn the nuances of resource cleanup across AWS, Azure, and GCP environments and apply safe Terraform practices.
We'll cover the following...
Deleting the resources
We’re (almost) finished with the quick exploration of Terraform using GKE as an example. We’ve seen how to add and change resources, and the only thing missing is to learn how to destroy them.
If we want to delete some of the resources, all we have to do is remove their definitions and execute terraform apply. However, in some cases, we might want to destroy everything. There’s a command for that as well.
We need to keep the storage where the Terraform state is stored. That will allow us to re-create the same cluster for the rest of the exercises. If we use AWS or GCP, we simply ...