hermes

Write a Terraform module

Writes a reusable Terraform module with typed, validated variables, secure defaults, documented outputs and an example. Use when wrapping cloud resources for other teams to consume.

context

A Terraform module is an API. Its variables are the inputs other teams depend on and its outputs are the contract they build on, so changing either later is a breaking change. Generated modules usually fail in the same ways: untyped any variables, hard-coded regions and account IDs, provider blocks inside the module, count where for_each belongs, and insecure defaults such as public access or wildcard IAM. The target here is a module a platform team would publish to its internal registry.

task

Write a reusable Terraform module for that does this: Only if [CONSTRAINTS] is given: Honour these constraints:

  1. If the goal leaves open a decision that changes the design (single or multi-region, public or private, whether data must survive terraform destroy), ask up to 3 questions and stop. If the gap is a detail, choose the safe default and record it under Assumptions.
  2. Draw the boundary: one cohesive purpose. Take shared things (VPC or network IDs, KMS keys, DNS zones) as inputs instead of creating them.
  3. Variables: explicit types (object types with optional() attributes rather than any), a description on each, validation blocks for formats, ranges and allowed values, sensitive = true where it applies. Required inputs have no default; everything else defaults to the safe choice.
  4. Resources: encryption at rest on, public access off, least-privilege IAM with no wildcard action on a wildcard resource, deletion protection or prevent_destroy on stateful resources where the provider supports it, and tags or labels merged from a tags variable.
  5. Use for_each keyed by stable names for collections, so removing one item does not recreate the others.
  6. Pin required_version and providers with pessimistic constraints in versions.tf. Never put a provider or backend block in the module.
  7. Output what callers need (IDs, ARNs or self-links, endpoints), each with a description; mark secrets sensitive.
constraints
  • Use only resources and arguments that exist in the current provider. If you are unsure an argument exists in the pinned version, say so under Assumptions instead of guessing silently.
  • No hard-coded account IDs, regions, CIDRs, image IDs or names. They come from variables or data sources.
  • No provisioners or local-exec unless the goal cannot be met otherwise; explain why if you use one.
  • The code must pass terraform fmt and terraform validate. You cannot run them here, so do not claim they pass.
  • Do only what was asked. If you notice something else worth changing, mention it in one line at the end instead of changing it.
  • Keep the change as small as it can be while still being correct.
output format

Assumptions

Bullets: each default you chose and why. "None" if the goal settled everything.

Files

One fenced hcl block per file, headed by its path: versions.tf, variables.tf, main.tf, outputs.tf, examples/basic/main.tf.

README

An inputs table (name, type, default, description), an outputs table, and a short usage paragraph.

Verify

The commands to run (terraform fmt -check, terraform validate, terraform plan on the example, plus a static scanner such as tflint or checkov) and what to look for in the plan.

1 required value still a placeholder; the assistant will ask for it.

details

kind
Prompt: a task you run by name to get one finished thing back
domain
Software engineering
category
DevOps
level
Intermediate
made for
DevOps / platform engineer, Site reliability engineer, Software engineer
risk
read-only
version
v1.0.0 · incubating
reviewed
2026-10-02
works in
Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Antigravity, OpenCode, Windsurf, Zed, Continue, AGENTS.md, ChatGPT, claude.ai

Edit on GitHubReport a problem

use in

Hodios CLI
npx @hermes-hq/hodios install write-terraform-module --target claude-code
Agent Skills
npx skills add hermes-hq/hodios-dist --skill write-terraform-module -a claude-code
Add the Hodios marketplace (once)
claude plugin marketplace add hermes-hq/hodios-dist
Install the software-engineering plugin
claude plugin install hodios-software-engineering@hodios

The plugin brings every entry in this domain at once.

pairs well with

All of DevOps
PromptDevOps

Review an infrastructure plan before apply

Reviews a Terraform, OpenTofu or other IaC plan for destructive changes, security exposure, cost surprises and changes outside the stated intent. Use before running apply, especially in production.

review-iac-plan
PromptDevOps

Design a deployment strategy

Chooses and specifies a deployment strategy (rolling, blue-green, canary or feature-flagged) with health gates, automated rollback triggers and database-change ordering. Use when deploys feel risky.

design-deployment-strategy
PromptDevOps

Review a Dockerfile

Reviews a Dockerfile for security, image size, build cache use and runtime correctness, and returns ranked findings with a corrected file. Use before shipping a new or changed container image.

review-dockerfile
PromptDevOps

Write a Docker Compose dev environment

Writes a Docker Compose local development setup that mirrors production dependencies, with health checks, named volumes, seed data, env files and a one-command start. Use when onboarding developers.

write-docker-compose
PromptDevOps

Write a GitHub Actions workflow

Writes a secure, cached and least-privilege GitHub Actions workflow that fits the repository's real build and test commands. Use when adding CI, a release job or a scheduled task.

write-github-actions-workflow
PersonaDevOps

DevOps engineer

Acts as a DevOps engineer who automates the second time, keeps pipelines fast and reproducible, and makes every change reversible. Use for CI/CD, infrastructure and release work.

devops-engineer