eric-sabe/engsys/iac-terraform
Claude Code and agent skill by eric-sabe/engsys
- community
Checking that the SKILL.md file is still in the repository.
Terraform & OpenTofu discipline and HCL code conventions — modules, remote state, workspaces, backends, plan/apply gates, drift detection, state surgery, security defaults, style, and .tftest.hcl testing. Activate when working on *.tf / *.tfvars files, terraform/tofu plan/apply/state operations, backend or workspace config, provider versioning, or diagnosing drift and partial applies.
Install
npx vskill@latest install eric-sabe/engsys/iac-terraformSKILL.md
The same SKILL.md was published earlier as eric-sabe/engsys/iac-terraform.
Terraform & OpenTofu Discipline and Conventions
Operational discipline and HCL coding conventions for Terraform and OpenTofu (*.tf, *.tfvars, *.tftest.hcl) — cloud-independent. Service-level resource detail comes from the active cloud-architecture-<cloud> pack; project file layout and backend config come from CLAUDE.md.
Core Stance
- Infrastructure is software. If it only works once, it doesn't work. "Just apply it again" is not a strategy — understand why it failed first.
- Plan is the contract. Never
applywithout reading theplan. Treat a surprising plan as a bug to investigate, not a step to skip. - Pin everything. Constrain the CLI version with
terraform.required_version, declare provider version constraints inrequired_providers, and commit.terraform.lock.hclto lock provider selections.
State Management & Surgery
- Remote state with locking, always (S3 + DynamoDB/native lock, GCS, Azure Blob lease, or Terraform Cloud). Never commit
.tfstatefiles. - Separate state per major component and environment (
devvs.prodnever share state) to minimize blast radius and lock contention. - State surgery when reality and state diverge (use the project's active IaC executable,
terraformortofu): <terraform|tofu> state list— inspect tracked resources<terraform|tofu> import <addr> <id>(orimport {}blocks) — adopt existing resourcesmoved { from = ... to = ... }or<terraform|tofu> state mv— refactor without destroy+recreate<terraform|tofu> state rm— stop tracking without deleting the underlying cloud resource- Always run
planimmediately after state surgery to confirm zero unintended diffs.
Security & Safe Defaults
- Never store secrets in `.tf`, `.tfvars`, or state where avoidable. Reference secrets from AWS Secrets Manager / SSM, Azure Key Vault, or GCP Secret Manager, and mark sensitive variables/outputs with
sensitive = true. - Enforce least-privilege IAM/OIDC roles, private networking by default, encryption at rest and in transit, and static IaC scanning (
trivy,checkov, ortflint) in CI. - Protect stateful resources (databases, disks, buckets) with
lifecycle { prevent_destroy = true }.
Modularity, Style & Testing Conventions
- Modules: Group cohesive resources into version-pinned modules with typed, documented
variableandoutputcontracts. Never wrap a single resource in a thin pass-through module. - File layout & ordering: Group by domain (
providers.tf,variables.tf,main.tf,network.tf,outputs.tf). Within a resource block, order:depends_on→for_each/count→ required attributes → optional attributes →lifecycle. Preferfor_each(keyed by stable string ID) over positionalcount. - Formatting & validation: Run
<terraform|tofu> fmt -check,<terraform|tofu> validate, andtflintbefore every commit using the active IaC executable. - Testing: Author idempotent
.tftest.hcltest suites covering both nominal and invalid variable inputs.
Plan / Apply Gates & Drift
- Pipeline gate:
fmt→validate→plan(posted on PR) → operator approval gate →applyon merge. - Inspect for `-/+` replacements: Never rubber-stamp a replacement on a stateful resource.
- Drift: Schedule
plan -refresh-onlychecks; reconcile any out-of-band click-ops back into.tfimmediately. - Preflight: Always run the active cloud's
*-deployment-preflightskill before applying.
Hard-Won Lessons
Span two control planes? Use a multi-provider graph so one apply wires both sides
- Symptom: Infrastructure crosses a cloud and a managed SaaS (e.g., Azure + MongoDB Atlas Private Endpoint), and single-cloud IaC (Bicep/CDK) leaves the SaaS half to manual console clicks.
- Fix: Use Terraform/OpenTofu multi-provider composition (e.g.,
azurerm+mongodbatlasin one root module) so a singleplan/applywires both sides of the boundary deterministically.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingstacks/iac/terraform/skills/iac-terraform/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/eric-sabe/engsys/iac-terraform)