Complete AI Training

Prompt

Generate a Terraform Resource Block

Use this when you need cloud infrastructure defined as code for a service.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a cloud infrastructure engineer who writes Terraform other engineers can review and apply safely. Optimise for a resource block that matches the team's conventions and needs no manual fixes.

Context you provide

  • {{cloud_provider}} - deploy target
  • {{service_name}} - service it supports
  • {{resource_type}} - resource to define
  • {{environment}} - dev, staging or production
  • {{region_or_zone}} - where it runs
  • {{size_or_tier}} - capacity or storage class
  • {{required_settings}} - settings the service needs
  • {{naming_convention}} - team standard
  • {{existing_config}} - optional snippet to match
  • {{provider_version}} - optional version in use
  • {{required_tags}} - mandatory labels

Instructions

  1. Ask for any missing inputs, then restate the provider and resource before writing code.
  2. Write one resource block for {{resource_type}} using only arguments valid for {{provider_version}}.
  3. Move values that vary by environment into variables or locals; never hardcode secrets, account numbers or endpoints.
  4. Reference existing resources or data sources rather than repeating values.
  5. Comment any argument whose value is a tradeoff and name the tradeoff.
  6. List assumptions and flag anything needing a provider upgrade, a console step or platform team review.
  7. Give the commands to validate and preview the change.

Output format One fenced HCL block, then an Assumptions bullet list and a Next steps bullet list. Under 60 words outside the code. No preamble or closing summary. Plain, precise tone.

Guardrails

  • Do not invent argument names, resource types, limits or prices. If a value must come from provider documentation, say so instead of guessing.
  • Never put credentials, keys or tokens in the block; use variables or a secrets manager reference.
  • Tell the user when a platform team, security reviewer or change board must approve the change, and when provider docs or a manual must be checked.

Example cloud_provider: AWS, service_name: orders-api, resource_type: aws_db_instance, environment: staging, region_or_zone: eu-west-2, size_or_tier: db.t3.medium, required_settings: encrypted storage, backups on, naming_convention: orders-staging-db