Skip to content
Back to skills

Infrastructure As Code

ASecurity

OpenTofu conventions. Module layout, provider abstraction, remote state, plan-before-apply, secrets. Use when scaffolding infra or deploying.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 7, 2026
developmentdockerawsgcpterraformgitdatabasebackend

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add samuel-stidham/smithy --skill infrastructure-as-code --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Infrastructure As Code?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Infrastructure As Code
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/samuel-stidham-infrastructure-as-code/badge)](https://www.skillsdirectory.com/skills/samuel-stidham-infrastructure-as-code)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: infrastructure-as-code
description: OpenTofu conventions. Module layout, provider abstraction, remote state, plan-before-apply, secrets. Use when scaffolding infra or deploying.
---

# Infrastructure as code

The source of truth for how the foundry writes and applies OpenTofu,
used by `foundry:scaffold --infra` and `foundry:deploy`. Provider
aware, never provider locked.

OpenTofu only. The generated HCL works with both the `opentofu` and
`terraform` binaries. When a user asks for terraform, explain this
and continue with OpenTofu.

## Layout

Infrastructure lives in `infra/` at the repo root, separate from any
`infrastructure/` application layer. The root holds `main.tf`
(module wiring), `variables.tf` (typed, described inputs),
`outputs.tf` (what a deploy needs afterward), `providers.tf`, and
`terraform.tfvars.example` (placeholders only), plus `modules/`.

## Modules by role

Name modules for the role, never a brand: `networking/`,
`container/`, `database/`, `secrets/`. Optional and opt-in: `cache/`
(default Redis) and `search/` (default Meilisearch). Generate an
optional module only when the app declares the dependency. Read the
signals: services in `docker-compose.yml`, keys in `.env.example`,
framework config such as `CACHE_STORE`, `QUEUE_CONNECTION`, or
`SCOUT_DRIVER`. The infra mirrors the app, never a wishlist.

## Providers

`--provider` accepts `aws`, `gcp`, or `digitalocean`. Each role maps
to the provider's nearest managed service, falling back to a
self-hosted container where none exists. Managed Meilisearch does not
exist anywhere. Self-host it with a persistent volume and say so in
the generated README. Provider specifics stay inside modules.
`main.tf` reads the same shape everywhere.

## State, discipline, and secrets

- Remote backend for state, always. State can hold secrets in plain
  text. The `.gitignore` excludes `*.tfstate`, `*.tfstate.*`, and
  `.terraform/`.
- Every apply runs `tofu fmt`, `tofu validate`, and `tofu plan`, then
  applies only after a human reads the plan and confirms. Never
  `tofu destroy` in a deploy. Never auto-approve an apply that
  creates or replaces resources.
- Secrets never live in HCL or committed files. The real
  `terraform.tfvars` is gitignored. Runtime secrets live in the
  provider's secret manager through the `secrets/` module. The app
  reads them from the environment, never from infra source.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.