eric-sabe/engsys/iac-terraform

Claude Code and agent skill by eric-sabe/engsys

Trust tier 3
  • community
Source check pending

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-terraform

SKILL.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 apply without reading the plan. 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 in required_providers, and commit .terraform.lock.hcl to lock provider selections.

State Management & Surgery

  • Remote state with locking, always (S3 + DynamoDB/native lock, GCS, Azure Blob lease, or Terraform Cloud). Never commit .tfstate files.
  • Separate state per major component and environment (dev vs. prod never share state) to minimize blast radius and lock contention.
  • State surgery when reality and state diverge (use the project's active IaC executable, terraform or tofu):
  • <terraform|tofu> state list — inspect tracked resources
  • <terraform|tofu> import <addr> <id> (or import {} blocks) — adopt existing resources
  • moved { 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 plan immediately 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, or tflint) 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 variable and output contracts. 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. Prefer for_each (keyed by stable string ID) over positional count.
  • Formatting & validation: Run <terraform|tofu> fmt -check, <terraform|tofu> validate, and tflint before every commit using the active IaC executable.
  • Testing: Author idempotent .tftest.hcl test suites covering both nominal and invalid variable inputs.

Plan / Apply Gates & Drift

  • Pipeline gate: fmt → validate → plan (posted on PR) → operator approval gate → apply on merge.
  • Inspect for `-/+` replacements: Never rubber-stamp a replacement on a stateful resource.
  • Drift: Schedule plan -refresh-only checks; reconcile any out-of-band click-ops back into .tf immediately.
  • Preflight: Always run the active cloud's *-deployment-preflight skill 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 + mongodbatlas in one root module) so a single plan/apply wires 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/eric-sabe/engsys/iac-terraform/badge)](https://verified-skill.com/skills/eric-sabe/engsys/iac-terraform)

Something wrong with this skill or its page? Tell us.