DevOps, CI/CD & Cloud
Target: Claude 3.7, Cursor, Windsurf, ChatGPT

Infrastructure-as-Code (Terraform) Security & Drift Review

Audit Terraform HCL code for IAM over-permissioning, unencrypted storage, public security groups, and drift risks.

TerraformAWSCloudDevOpsSecurityIaC

Interactive Prompt Playground

Customize Template Fields
Live replacement
{{TERRAFORM_HCL}}
{{CLOUD_PROVIDER}}
Rendered Prompt (Ready to paste)1344 characters
You are a Principal Cloud Security Architect and Terraform Specialist.

Audit and harden the following Terraform / OpenTofu HCL code:

Terraform HCL Code:
```hcl
resource "aws_s3_bucket" "uploads" {
  bucket = "company-user-uploads"
}

resource "aws_security_group" "db_sg" {
  name = "database-sg"
  ingress {
    from_port   = 5432
    to_port     = 5432
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}
```

Cloud Provider: AWS (us-east-1)
Security Benchmark: CIS Benchmarks & SOC 2 Compliance

Review against cloud security and IaC best practices:
1. **IAM & Least Privilege**:
   - Catch wildcard permissions (`Action: "*"`, `Resource: "*"`).
   - Ensure service roles use explicit principle restrictions and condition keys.
2. **Network & Security Groups**:
   - Flag any security group rules allowing `0.0.0.0/0` on sensitive ports (SSH 22, Postgres 5432, Redis 6379).
3. **Encryption at Rest & in Transit**:
   - Verify KMS encryption on S3 buckets, RDS databases, EBS volumes, and DynamoDB tables.
   - Ensure S3 buckets enforce `public_access_block` and SSL-only bucket policies.
4. **State Management & Secrets**:
   - Verify secrets are retrieved from AWS Secrets Manager / Vault rather than hardcoded in HCL.
5. **Hardened Terraform HCL**:
   - Provide the refactored, fully compliant HCL code with clear explanations.

How to Use This Prompt

  1. Paste your Terraform HCL resources.
  2. Specify your cloud provider and compliance standard (CIS, SOC 2).
  3. Get a hardened, secure Terraform configuration.

Engineering Tips & Best Practices

  • Always attach aws_s3_bucket_public_access_block and aws_s3_bucket_server_side_encryption_configuration to every S3 bucket.

What This Prompt Inspects

Key failure modes, design principles, and quality standards evaluated during execution.

No Public Ingress on DB

Blocks direct internet access to database and cache ports.

S3 Public Access Block

Enforces default block-all-public-access on all cloud storage buckets.

KMS Customer-Managed Keys

Applies KMS envelope encryption with rotation enabled.

SprintKit Workflow Integrations

Complementary interactive tools and workflows across SprintKit to accelerate your engineering process.

Related Prompts

Explore related developer prompts in this workflow domain.

All Prompts

Kubernetes Deployment, HPA & Resource Limits Review

Audit Kubernetes manifests for CPU/memory requests, readiness/liveness probes, HPA, and Pod Disruption Budgets.

KubernetesK8sDevOpsCloud+1
3 variablesCustomize prompt

Production Dockerfile Multi-Stage Optimization & Hardening

Optimize Dockerfiles for minimal image size, non-root security, layer caching, and CVE vulnerability reduction.

DockerContainersDevOpsSecurity+1
3 variablesCustomize prompt

Security Vulnerability & OWASP Code Audit

Audit backend and frontend code for OWASP Top 10 vulnerabilities, authentication bypasses, IDOR, and injection flaws.

SecurityOWASPAuthBackend+1
3 variablesCustomize prompt