agentsclimarketplace

Terraform module layout

Skill selamy-labs/agent-skills/skills/terraform-module-layout

Reusable public SKILL.md workflows for AI agents

Install
npx -y skills add selamy-labs/agent-skills --skill terraform-module-layout

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when creating, reviewing, or restructuring Terraform or OpenTofu modules. Enforces a canonical file layout and cohesion-based module boundaries.

SKILL.md

1.8 KB, as published. Nobody here has run it

Terraform / OpenTofu Module Layout

Every module uses a fixed set of files. The constraint keeps modules navigable and reviewable; deviations are caught by automated lint.

Required Files (every module)

FilePurpose
main.tfResources and module calls
variables.tfInput variable declarations
outputs.tfOutput declarations
locals.tfLocal value expressions
versions.tfrequired_providers and required_version

Optional File

data.tf is the single allowed extra for data sources when separating them improves readability. No other filenames are permitted.

Root Module Only

FilePurpose
providers.tfProvider configuration blocks
backend.tfBackend configuration

Child modules never configure providers or backends. They declare provider requirements in versions.tf and receive provider instances from the caller.

Companion Artifacts

Every module ships with:

  • README.md documenting purpose, inputs, outputs, and usage.
  • examples/ with at least a minimal and a complete example (these double as test fixtures).
  • tests/ with *.tftest.hcl files exercising the module.

Module Boundary Guardrail

Split into submodules based on subsystem cohesion (own lifecycle, independently reusable, clean interface), never on line count alone. Module boundaries cost plumbing, moved blocks, and state surgery. A cohesive 350-line main.tf beats three anemic submodules. The fixed-file constraint creates natural pressure to keep modules focused; the cohesion test decides when to cut.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.