From infra-skills
Create an S3 + DynamoDB Terraform backend on AWS — guided setup with bootstrap, apply, and state migration workflow.
How this skill is triggered — by the user, by Claude, or both
Slash command
/infra-skills:terraform-backend-awsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You walk the user through creating a Terraform remote backend on AWS. This creates an S3 bucket for state storage and a DynamoDB table for state locking, then migrates from local to remote state.
You walk the user through creating a Terraform remote backend on AWS. This creates an S3 bucket for state storage and a DynamoDB table for state locking, then migrates from local to remote state.
Ask the user for:
my-project-admin)myproject)eu-west-1)myproject-terraform-state)myproject-terraform-locks)myproject/terraform/backend/terraform.tfstate)Verify credentials before proceeding:
export AWS_PROFILE=<profile>
aws sts get-caller-identity
Use the assets in assets/ as the starting point. Copy them to the working directory and customize:
| Asset | Customize |
|---|---|
main.tf | Replace {project} prefix in resource names and tags |
variables.tf | Ready to use as-is |
outputs.tf | Replace {project} prefix in descriptions |
terraform.tfvars.example | Fill in with user's values, copy to terraform.tfvars |
Makefile | Set CONFIG_FILE path and STATE_KEY, replace profile names in messages |
.gitignore | Ready to use as-is |
The terraform.tfvars file drives everything — the Makefile extracts backend config values from it since Terraform doesn't support variables in backend blocks.
This is a three-phase process. The backend infrastructure doesn't exist yet, so we start with local state:
make bootstrap-init # terraform init -backend=false
make bootstrap-apply # terraform apply (creates S3 + DynamoDB with local state)
The bootstrap-init disables the remote backend entirely. The bootstrap-apply creates the S3 bucket and DynamoDB table while storing state locally in terraform.tfstate.
Once the infrastructure exists, migrate the local state into it:
make migrate-state
This runs terraform init -migrate-state with the backend config extracted from tfvars. Terraform will ask to copy existing state to the new backend — answer yes.
After migration:
terraform.tfstate can be deletedmake init (not make bootstrap-init)make init # Should connect to remote backend
make plan # Should show no changes
make output # Should display bucket and table info
After setup, the standard workflow is:
make init # Initialize (first time in a new checkout)
make plan # Preview changes
make apply # Apply changes
make output # Show current state
make validate # Check config syntax
make fmt # Format .tf files
npx claudepluginhub eyelock/assistants --plugin infra-skillsCreates reusable Terraform modules for AWS resources, manages remote state with S3/DynamoDB, and applies HCL best practices. Use for building or reviewing AWS infrastructure.
Manages Terraform state files: local/remote backends (S3, Terraform Cloud, Azure), locking (DynamoDB), commands (list, show, mv, rm, pull, push, import), workspaces, and best practices for infrastructure coordination.
Provisions and manages cloud infrastructure using Terraform with HCL modules, remote state backends, and plan/apply workflow. Useful for IaC, multi-environment setup, and migrating from ClickOps or CloudFormation.