In this blog post and video, we'll explore the process of deleting resources that are managed by Terraform in your Kion installation. Managing infrastructure through Terraform offers great flexibility and control, including the ability to delete resources. Let's look at two methods to accomplish this: commenting out resources and using the Terraform Destroy command.
Commenting Out Resources
The first method involves commenting out the resource configuration in your Terraform files. Let's say we no longer want a specific cloud rule to exist because Terraform is managing it. By commenting out the resource block related to that cloud rule and running
terraform plan, Terraform will recognize that the resource is no longer part of the configuration and initiate its deletion. Running
terraform apply and confirming the action will send the deletion request to Kion, effectively removing the cloud rule from the system.
Using the Terraform Destroy Command
The second method involves using the
terraform destroy command to delete all resources managed by Terraform in Kion . When executing
terraform destroy, Terraform displays the list of resources it intends to destroy and prompts for confirmation before proceeding. Once confirmed, Terraform initiates the deletion process.
After deleting resources using either method, you may want to recreate them. As long as you still have the resource configurations in your Terraform files, you can easily recreate the resources. Running
terraform plan will show that the resources are ready to be created. By executing
terraform apply and confirming the action, Terraform will recreate the resources in Kion based on the configuration. However, it's important to note that if you have commented out a resource block, it will not be recreated.
Deleting resources managed by Terraform in Kion is a straightforward process that provides flexibility in managing your infrastructure. By either commenting out the resource block or using the
terraform destroy command, you can remove resources from Kion . If needed, you can also recreate the resources by uncommenting the resource block and running
terraform apply. Terraform empowers you with efficient resource management capabilities, making infrastructure changes and cleanup a breeze.
We hope our series of Feature Friday blogs on managing Kion resources with Terraform has been helpful in understanding how to import, modify, and delete resources in Kion using Terraform.
If you'd like to learn more about our Terraform integration - and see how Kion can help you with cloud management and governance - please request a demo.