Over the course of these tutorials, you created a DynamoDB table in AWS, a Terraform Cloud workspace, and a GitHub repository.
In this tutorial, you will destroy the DynamoDB table and delete your Terraform Cloud workspace.
»Destroy infrastructure
Now that you have provisioned and changed infrastructure with Terraform Cloud, the last part of your infrastructure's lifecycle will be to destroy it. Terraform Cloud allows you to destroy the infrastructure you have provisioned as a part of the standard workflow.
To destroy the infrastructure you provisioned in these tutorials, go to your workspace in the Terraform Cloud UI. Next, from the top menu, select "Settings -> Destruction and Deletion".
From this page you can:
- Queue destroy plan destroys all infrastructure managed by the workspace.
- Delete from Terraform Cloud deletes your workspace from Terraform Cloud without destroying the infrastructure the workspace manages.
Note: Deleting a workspace does not destroy its infrastructure. For example, if you were to delete this workspace, the AWS DynamoDB table you provisioned earlier would still exist.
»Queue a destroy plan
Click the red "Queue destroy plan" button.
Terraform Cloud will prompt you to enter your workspace name before you can queue a destroy plan.
Enter your workspace name and queue the plan.
»Destroy the infrastructure
As it does with all plans, Terraform Cloud will ask you to "Confirm and Apply" the plan. Do so now to destroy your DynamoDB instance.
After a few minutes, the apply step should complete successfully.
Verify that the DynamoDB instance was destroyed by visiting the AWS web console in the region where you created it. The configuration defaults to using the N. California/us-west-1 region.
»Delete the AWS IAM user (optional)
If you created an AWS IAM user for these tutorials, delete or disable this user in the AWS console. Navigate to the Identity Access Management (IAM) section, and then to the user you created. Use the AWS Console to delete the user, or disable the user's access keys.
»Delete the workspace (optional)
If you don't plan to run these tutorials again and want to keep your Terraform Cloud organization clean you can optionally delete the workspace you created. Terraform Cloud doesn't limit the number of workspaces you have or charge per workspace, so whether or not you delete the workspace is up to you.
To delete the workspace, return to the "Settings -> Destruction & Deletion" page, and click the red "Delete from Terraform Cloud" button.
Terraform Cloud will prompt you to enter your workspace name before you can click "Delete workspace". Input the workspace name and click the button to delete the workspace.
»Next steps
In these tutorials you used Terraform Cloud to provision, change, and destroy infrastructure. Now you are ready to learn more about developing Terraform configurations. We recommend downloading the Terraform CLI so you can develop configurations locally. Get started with the CLI on your preferred cloud platform:
At the end of the CLI tutorials you will log into Terraform Cloud via the CLI, and get practice with Terraform Cloud's CLI-driven workflow.
You can use the CLI workflow alongside the VCS workflow in these tutorials to develop infrastructure configuration locally, commit it to version control, and deploy it into production.
To explore Terraform Cloud's paid features (which you can enable with a free trial), continue to the next tutorial. These include enforcing policies with Sentinel policy-as-code, and estimating the cost of infrastructure changes.
Learn more about the concepts you used in these tutorials by exploring the documentation.