This repository contains test Terraform configurations for testing deployment automation.
backend/- Creates S3 bucket and DynamoDB table for Terraform state managementmain/- Main Terraform project that uses remote state and creates test AWS resources
First, deploy the backend infrastructure to create the S3 bucket for state storage:
cd backend
terraform init
terraform plan
terraform applyAfter applying, note the outputs, especially state_bucket_id.
Update the backend configuration in main/main.tf with the values from the backend outputs:
backend "s3" {
bucket = "terraform-state-xxxxxxxx" # From backend output
key = "terraform.tfstate"
region = "us-east-1"
dynamodb_table = "terraform-state-lock-xxxxxxxx" # From backend output
}cd main
terraform init
terraform plan
terraform apply- S3 bucket for Terraform state with versioning and encryption
- DynamoDB table for state locking
- Proper security configurations
- S3 bucket (fast to create)
- CloudWatch log group (fast to create)
- SSM parameter (fast to create)
- IAM role and policy (fast to create)
All resources are designed to be quick to create and destroy for testing purposes.
To destroy resources:
# Destroy main infrastructure first
cd main
terraform destroy
# Then destroy backend infrastructure
cd ../backend
terraform destroy