Works with the AI Agents you already use

    AWS Terraform Security Review: fix risks before apply

    by Rubbaite T. Hassain

    1

    Scan a Terraform plan for the AWS misconfigurations behind real breaches (public S3, open SSH and database ports, admin IAM, unencrypted RDS, secrets in state) and get a fix for each before you apply.

    Free

    Security scanned
    AWS Terraform Security Review: fix risks before apply

    AWS Terraform Security Review: fix risks before apply

    Example session with this skill installed

    Review our Terraform for the payments VPC before we apply it. Focus on anything exposed to the internet. The plan is in plan.json.

    • Read your context and instructions
    • Compiled the aws terraform security

    Summary

    Scanned 16 planned resources (including the logs module):

    4 critical, 7 high, 9 medium, 5 low. Three changes remove most of the risk: scope the IAM policy, add a sub condition to the GitHub deploy role, and close the internet-wide security group rule.

    Critical and high findings

    SeverityResourceFindingFix
    CRITICALaws_iam_policy.appAction: * on Resource: * (full admin)List only the actions and ARNs the app needs
    CRITICALaws_iam_role.deployGitHub OIDC role has no sub condition: any repository can assume itStringLike token.actions.githubusercontent.com:sub = repo:acme/payments:ref:refs/heads/main
    CRITICALaws_vpc_security_group_ingress_rule.allAll ports open to 0.0.0.0/0Remove; open only 443 from the load balancer
    CRITICALaws_s3_bucket_acl.reportsBucket ACL is public-readSet private; object_ownership = "BucketOwnerEnforced"
    HIGHaws_security_group.webSSH 22 and PostgreSQL 5432 open to the internetSession Manager for admin; DB only from the app security group
    HIGHaws_db_instance.mainPublicly accessible, storage not encryptedSee fix below (encryption needs snapshot-restore)
    HIGHaws_lambda_function.apiSTRIPE_API_KEY in plaintext environment variableSecrets Manager, read at runtime
    HIGHaws_lambda_function_url.apiNo authenticationauthorization_type = "AWS_IAM"

    Fix example

    resource "aws_db_instance" "main" {
      publicly_accessible         = false
      storage_encrypted           = true
      manage_master_user_password = true   # replaces password = "..."
      backup_retention_period     = 7
      deletion_protection         = true
    }
    

    Enabling encryption on an existing instance replaces it: plan a snapshot and restore in a maintenance window.

    Next steps

    1. Apply the critical fixes and re-run the scan.
    2. Confirm intent for the HTTP listener without HTTPS redirect (medium) and the public IP on aws_instance.app (low).
    3. Add the scanner to CI with --min-severity medium.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Most AWS incidents start with one line of infrastructure code: a public bucket, port 22 open to the internet, a policy with Action: * on Resource: *. This skill makes your agent review Terraform the way a cloud security architect would, before anything reaches your account.

    What it does

    • Reads the real plan (terraform show -json), so variables, modules and defaults are all resolved.
    • 38 checks across S3, security groups, RDS, IAM (including GitHub OIDC roles with no sub condition), EC2/IMDSv2, EBS, CloudTrail, KMS, Lambda, load balancers and EKS.
    • Severity-ranked report with the Terraform change that fixes each finding, and a warning when a fix replaces a resource.
    • Manual checklist for what scanners cannot judge: intent, state storage, module pinning, cross-account trust.
    • Works with your tools: merges Checkov or Trivy results if installed, and adds a CI gate.

    How it works

    1. Generate plan.json (the agent warns you that it can contain secrets and should stay local).
    2. Run the bundled scanner (standard-library Python, no network calls).
    3. Review intent with you using the checklist.
    4. Write security-review.md with fixes, accepted risks and next steps.

    Read-only by design: it never runs apply, destroy, import or state commands.

    What's included

    SKILL.md, scripts/scan_plan.py, a review checklist, and insecure and secure sample plans to try it on.

    Known limitations

    • Covers common AWS resources, not every service. A clean scan is not a guarantee.
    • Values unknown until apply cannot be checked in a plan.
    • Account-level controls (SCPs, organisation trails) may live in another repository.

    Need a full Azure or AWS cost and security assessment? Datazo InfoTech, the author's company, does them.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 9 days ago

    • Free with an Agensi account

    Software
    Python 3.9+
    Terraform
    orOpenTofu
    Optional
    Checkov
    orTrivy

    plan.json can contain secrets: keep it local and delete it after the review.

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Environment Variables
    Listed9 days ago

    What's inside

    Frequently Asked Questions

    No. It never runs terraform apply, destroy, import or state commands. It reads the plan and your code, and writes a report.

    Only to create the plan. You can run terraform plan yourself and give the agent plan.json; the scanner itself makes no network calls.

    It reviews the resolved plan (modules, variables and defaults applied) with a deterministic 38-check scanner, then reviews intent with you, so findings are repeatable and each comes with a concrete Terraform fix.

    No, it complements them. It adds intent review, fixes in context and a readable report, and can merge their output. It also works with OpenTofu.

    SKILL.md with the review workflow, scripts/scan_plan.py (standard-library Python, 38 checks, Markdown and JSON output), a manual review checklist, and insecure and secure sample plans to try it on. MIT licence, free.

    It focuses on the resources behind most incidents: S3, security groups, RDS, IAM, EC2/EBS, CloudTrail, KMS, Lambda, load balancers and EKS. Other services are reviewed manually with the checklist, and values unknown until apply cannot be checked.

    New in DevOps & Cloud

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for DevOps & Cloud.

    Free