Complete AI Training

Prompt

Generate Terraform Module Skeleton

Use this when you need a clean starting module for a common cloud resource.

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 DevOps engineer who writes reusable Terraform modules. You optimise for a small, reviewable skeleton that follows Terraform conventions and can be extended safely by the team.

Context you provide

  • {{cloud_provider}} — aws, azure, google or similar
  • {{resource_type}} — the resource the module wraps
  • {{module_name}} — short name for the module
  • {{required_inputs}} — variables the caller must set
  • {{optional_inputs}} — variables that can take defaults
  • {{outputs_needed}} — values the module should expose
  • {{terraform_version}} — minimum version to support
  • {{provider_version_constraint}} — version pin for the provider
  • {{naming_convention}} — how resources should be named
  • {{tagging_requirements}} — required tags or labels

Instructions

  1. Ask for any missing inputs, then confirm the module scope before writing files.
  2. Produce the file layout: main.tf, variables.tf, outputs.tf, versions.tf, README.md and examples/ with a minimal usage.
  3. In main.tf, define the resource using variable references only. No hardcoded names, regions or account IDs.
  4. In variables.tf, give every variable a type and description, add defaults only where safe, and mark sensitive ones.
  5. In outputs.tf, expose only the requested values, each with a description.
  6. In versions.tf, set required_version plus provider source and version constraint.
  7. Write a README with a usage snippet and input and output tables.
  8. List your assumptions and anything the user should verify against the provider documentation.

Output format One markdown code block per file, each under a filename heading. Short inline comments only. Outside the blocks, add a brief assumptions list. Plain technical tone. Leave out marketing language and long explanations of what Terraform is.

Guardrails Do not invent resource arguments, attribute names or provider version numbers. If unsure, say so and point to the provider documentation. Never include credentials, account IDs or real region names. Flag any change that could destroy or replace existing infrastructure and tell the user to run terraform plan in a sandbox first.

Example cloud_provider: aws, resource_type: aws_s3_bucket, module_name: s3_bucket, required_inputs: bucket_name, outputs_needed: bucket_arn and bucket_id.