Guides Terraform for AWS: module layout, naming, multi-environment roots, state backends/locking, IAM least privilege, KMS key policies, secrets out of state, OIDC for CI, and GitHub Actions plan/apply pipelines.
Ships in aws-infrastructure-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
| Topic | Reference File | Key Insight |
|---|---|---|
| Module structure | references/terraform-structure.md | Don't wrap single resources in modules |
| Naming conventions | references/terraform-structure.md | Consistent name_prefix locals pattern |
| State management | references/terraform-structure.md | S3 native locking (Terraform 1.10+) — DynamoDB lock is deprecated |
| State backend bootstrap | references/terraform-structure.md | Separate bootstrap project with local state, SSE-KMS, CI/CD access policy |
| IAM & security | references/security-iam.md | LeadingKeys for multi-tenant, policy composition, confused deputy, KMS key policy |
| Checkov (DynamoDB, Lambda, API GW) | references/security-iam.md | CKV_AWS_28/119 (DynamoDB), CKV_AWS_258 (Lambda URL), CKV_AWS_76/CKV2_AWS_29 (API GW) |
| Secrets in Terraform state | references/security-iam.md | Use ephemeral resource (Terraform 1.10+); protect state with SSE-KMS S3 backend |
| CI/CD OIDC federation | references/security-iam.md + references/cicd-patterns.md | aws_iam_openid_connect_provider + sts:AssumeRoleWithWebIdentity — no static keys |
| CI/CD pipelines | references/cicd-patterns.md | Use OIDC — never store AWS keys as secrets |
| Environments in one root | references/terraform-structure.md | env/<env>.s3.tfbackend + env/<env>.tfvars; *.auto.tfvars loads in every environment; validation blocks POC switches in prod |
| Console and Terraform both edit a resource | references/terraform-structure.md | One owner per resource; removed with destroy = false hands it to the console |
| Multi-env pipelines | references/cicd-patterns.md | Per-branch backend keys, env resolver, ephemeral cleanup |
| Promotion and saved plans | references/cicd-patterns.md | Build once and promote the digest; dev re-plans on merge, prod applies the approved saved plan; plan files are cleartext |
| Pipeline safety | references/cicd-patterns.md | Concurrency per env, environment protection gates, drift detection |
Resource: "*" in IAM policies — scope to specific ARNs with conditionsAdministratorAccess to Lambda execution rolessource_arn on aws_lambda_permission when principal is a service — leaves the function open to confused deputy attacks across accounts* — pre-create aws_cloudwatch_log_group in Terraform and scope to that log group ARN; eliminates logs:CreateLogGroup on wildcardsqs:* on * for Lambda SQS consumers — only three actions are required: sqs:ReceiveMessage, sqs:DeleteMessage, sqs:GetQueueAttributes, scoped to the specific queue ARNserver_side_encryption { enabled = true } alone for DynamoDB — no kms_key_arn uses AWS-owned key and fails Checkov CKV_AWS_119kms:* on the account principal delegates access to any IAM role with kms:*; use explicit per-role statementsauthorization_type = "NONE" on aws_lambda_function_url — publicly invocable without auth; fires Checkov CKV_AWS_258data "aws_secretsmanager_secret_version" in Terraform ≥ 1.10 — use ephemeral to avoid writing the secret value to stateterraform apply, destroy, state commands, -target or -auto-approve from an agent session. Apply runs in CI from the approved saved plan. The aws-iac-team-harness skill installs the checks and the reference workflow.-target" as a working rule. It means a resource has two owners; give each one owner (terraform-structure.md)ref:refs/heads/main when the job uses an environment. Its OIDC sub is the environment formcancel-in-progress: true on apply/destroy jobs — cancelling mid-apply corrupts statedefault_tags with Branch tag — orphaned resources become untrackableenvironment: { name: ${{ needs.x.outputs.y }} } for dynamic environment names — more explicit, avoids ambiguity in YAML parsersenvironment: name: without pre-creating the environment in repo settings — non-existent names silently create unprotected environments with no reviewers| Create a Module | Use Resource Directly |
|---|---|
| 3+ resources always deployed together | Single resource with no dependencies |
| Reused across 2+ environments or repos | One-off resource |
| Encapsulates non-obvious wiring (IAM + resource) | Simple resource with standard config |
| Feature | Terraform Core | Terraform AWS Provider |
|---|---|---|
| S3-native state locking (no DynamoDB lock table) | 1.10+ | any |
| Ephemeral resources for secrets | 1.10+ | any |
For prices, use the AWS Pricing MCP server (awslabs.aws-pricing-mcp-server). Its README has the setup. Prices in this skill are dated examples, not quotes.
Load only the reference file that matches the user's question. Never bulk-load all three.
| User is asking about | Load |
|---|---|
| Module structure, naming, state, backend buckets, several environments, console ownership | references/terraform-structure.md |
| IAM policies, least privilege, role design, SCPs, Checkov checks, KMS, secrets in state, OIDC | references/security-iam.md |
| CI/CD, GitHub Actions, OIDC, pipelines, promotion, saved plans, ephemeral envs, drift | references/cicd-patterns.md |
For infrastructure reviews: load terraform-structure.md and security-iam.md. Only add cicd-patterns.md if the review scope includes pipeline config.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
7 skills in this plugin
/aws-connectUse when writing or reviewing Terraform for Amazon Connect: contact flows and flow modules, a Lambda function invoked from a flow, queues, routing profiles, security profiles and access-control tags, users, approved origins, adopting console-built resources, PHI in flow logs and contact attributes, or contact events to EventBridge and SQS. Not for general Lambda tuning (aws-serverless) or IAM and pipelines (terraform-aws)./aws-dynamodbUse when designing or reviewing a DynamoDB table: access patterns, partition and sort keys, single-table design, GSIs and sparse indexes, hot partitions, one-to-many and many-to-many modeling, capacity mode and cost, or the Terraform for the table.//aws-infrastructure-skills:terraform-awsfrom aws-infrastructure-skills
npx claudepluginhub a-pavithraa/aws-serverless-skill --plugin aws-infrastructure-skills