AdvancedDevOpsFree prompt

Infrastructure as Code with Terraform for AWS/Hetzner

Automated cloud infrastructure provisioning with Terraform, reusable modules, and state management.

Automate provisioning of all infrastructure required for a production application, ensuring reproducibility, version control, and compliance.

At a glance

Access

Free prompt

Open to copy without upgrading.

Prompt objective

Automate provisioning of all infrastructure required for a production application, ensuring reproducibility, version control, and compliance.

Real use case

A fintech company provisions servers manually through the AWS console. After a key infrastructure engineer departed, the team lacks visibility into what is actually running. They have [NUMBER] EC2 instances, [NUMBER] RDS databases, [NUMBER] S3 buckets, and [NUMBER] VPCs all configured manually. They need to document and automate everything.

Customize these fields first

PROJECT NAMEAWS/HETZNER/GCPEC2/ECS/HETZNER CLOUDNUMBERRDS POSTGRESQL/HETZNER + DOCKERELASTICACHE REDIS/SELF-HOSTEDS3/HETZNER STORAGE BOXCLOUDFRONT/CLOUDFLARE

Replace the placeholders with your own context before you run the prompt. That usually improves the first output more than adding more instructions later.

Prompt

Create infrastructure as code with Terraform for [PROJECT NAME], deployed on [AWS/HETZNER/GCP].\\\\\\\\n\\\\\\\\n**Target Architecture:**\\\\\\\\n- Compute: [EC2/ECS/HETZNER CLOUD] — [NUMBER] instances\\\\\\\\n- Database: [RDS POSTGRESQL/HETZNER + DOCKER]\\\\\\\\n- Cache: [ELASTICACHE REDIS/SELF-HOSTED]\\\\\\\\n- Storage: [S3/HETZNER STORAGE BOX]\\\\\\\\n- CDN: [CLOUDFRONT/CLOUDFLARE]\\\\\\\\n- DNS: [ROUTE53/CLOUDFLARE]\\\\\\\\n- Network: VPC with public and private subnets\\\\\\\\n\\\\\\\\n**1) Terraform Project Structure:**\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\nterraform/\\\\\\\\n├── environments/\\\\\\\\n│   ├── staging/\\\\\\\\n│   │   ├── main.tf\\\\\\\\n│   │   ├── variables.tf\\\\\\\\n│   │   └── terraform.tfvars\\\\\\\\n│   └── production/\\\\\\\\n├── modules/\\\\\\\\n│   ├── networking/\\\\\\\\n│   ├── compute/\\\\\\\\n│   ├── database/\\\\\\\\n│   ├── cache/\\\\\\\\n│   └── monitoring/\\\\\\\\n└── global/\\\\\\\\n    ├── iam/\\\\\\\\n    └── dns/\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\n\\\\\\\\n**2) Reusable Modules:**\\\\\\\\nFor each module, define: variables, resources, outputs, README\\\\\\\\n\\\\\\\\n- **networking**: VPC, subnets (public/private), NAT Gateway, security groups\\\\\\\\n- **compute**: instances/containers, auto-scaling, load balancer, target groups\\\\\\\\n- **database**: RDS/PostgreSQL with read replica, automated backups, parameter group\\\\\\\\n- **cache**: Redis cluster with failover\\\\\\\\n- **monitoring**: CloudWatch alarms, SNS topics, dashboards\\\\\\\\n\\\\\\\\n**3) State Management:**\\\\\\\\n- Remote state in S3 + DynamoDB lock (AWS) or Terraform Cloud\\\\\\\\n- State per environment (staging/production)\\\\\\\\n- Import existing resources (\\\\\\\\\\\\\\\\\\\\\\\`terraform import\\\\\\\\\\\\\\\\\\\\\\\`)\\\\\\\\n- Safe state manipulation (move, remove)\\\\\\\\n\\\\\\\\n**4) Security:**\\\\\\\\n- IAM roles with least privilege\\\\\\\\n- Restrictive security groups\\\\\\\\n- Encryption at rest (KMS)\\\\\\\\n- Secrets in AWS Secrets Manager (not in terraform.tfvars)\\\\\\\\n- VPC endpoints for AWS services\\\\\\\\n\\\\\\\\n**5) CI/CD for Terraform:**\\\\\\\\n- GitHub Action: \\\\\\\\\\\\\\\\\\\\\\\`plan\\\\\\\\\\\\\\\\\\\\\\\` on PR, \\\\\\\\\\\\\\\\\\\\\\\`apply\\\\\\\\\\\\\\\\\\\\\\\` on merge to main\\\\\\\\n- Validation: \\\\\\\\\\\\\\\\\\\\\\\`terraform fmt\\\\\\\\\\\\\\\\\\\\\\\`, \\\\\\\\\\\\\\\\\\\\\\\`terraform validate\\\\\\\\\\\\\\\\\\\\\\\`, \\\\\\\\\\\\\\\\\\\\\\\`tflint\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\n- Cost estimation with Infracost\\\\\\\\n- Manual approval before apply in production\\\\\\\\n\\\\\\\\n**6) Cost Estimate:**\\\\\\\\n- Monthly cost per resource\\\\\\\\n- Optimizations: Reserved Instances, Spot for workers, S3 lifecycle\\\\\\\\n- Comparison: AWS vs. Hetzner for this workload\\\\\\\\n\\\\\\\\nProvide complete \\\\\\\\\\\\\\\\\\\\\\\`.tf\\\\\\\\\\\\\\\\\\\\\\\` files for the [PRODUCTION/STAGING] environment.

Open directly in an AI — the text is pre-filled:

How to use this prompt

  1. 1Replace the key placeholders first: PROJECT NAME, AWS/HETZNER/GCP, EC2/ECS/HETZNER CLOUD, NUMBER.
  2. 2Replace any bracketed placeholders like [this] with your own context.
  3. 3Add extra background information when you want more tailored results.
  4. 4Combine multiple prompts in one conversation when you need a richer output.
  5. 5Save your best-performing prompts so they are easy to reuse later.

Next best step

Open the guide first, then branch only if you still need more.

A guide for technical builders choosing between prompts, coding workflows, and agent-based implementation.

If this prompt is close but not quite right, generate variants next. If the job is recurring, move into the course library after the guide.

Related prompts

View all

Explore other prompt categories

Move sideways into adjacent libraries when the current category is not the full answer.

Free browsing stays open. Premium prompts unlock the reusable workflow layer.

Use the guides and role paths to validate the job first. Upgrade when you want the full prompt text, editable premium prompts, and the surrounding course paths in one place.

Free access

  • Browse guides, role paths, and category pages.
  • Preview prompts before you decide to upgrade.
  • Find the right starting point without friction.

Membership access

  • Unlock premium prompts and the full copy text.
  • See more workflow paths and course connections.
  • Keep the reusable templates in one place.
Chat on WhatsApp