21 lines
595 B
Markdown
21 lines
595 B
Markdown
# 7) Cleanup (5 min)
|
||
|
||
Always delete resources to avoid charges.
|
||
|
||
From each working directory you used:
|
||
```bash
|
||
terraform destroy -auto-approve || true
|
||
```
|
||
|
||
If you created the S3 bucket and DynamoDB table for backend testing, remove them **after** you’ve destroyed all Terraform-managed resources and the state is no longer needed.
|
||
|
||
Delete S3 (must be empty first):
|
||
```bash
|
||
aws s3 rm s3://my-terraform-state-lab --recursive
|
||
aws s3api delete-bucket --bucket my-terraform-state-lab --region ap-south-1
|
||
```
|
||
|
||
Delete DynamoDB table:
|
||
```bash
|
||
aws dynamodb delete-table --table-name terraform-locks
|
||
``` |