infrastructure-as-code
Skill31 starsChanged 18 days agoMITView on GitHub
Use when provisioning or changing cloud infrastructure with Terraform or Ansible — modules, remote state with S3 native locking, workspaces vs directory-per-env, common AWS patterns, idempotent Ansible roles for Debian/Ubuntu, GitOps with ArgoCD/Flux, drift detection, and Vault secret injection.
- Reads credentials
16 other projects use a version of this.
Adopted by
Most recently taken up by
- AxlZero21/Skillstheir own version, first seen Nov 8, 2026
- pfangueiro/claude-code-agentstheir own version, first seen Nov 8, 2026
- reddygopalkrishna/developer-agent-skillstheir own version, first seen Nov 8, 2026
- SWEStash/swe-workflow-skillstheir own version, first seen Nov 8, 2026
- Indium-AI-Labs/indium-agentkittheir own version, first seen Nov 1, 2026
- KMaruthi2002/universal-llm-skillstheir own version, first seen Oct 25, 2026
Used with
Projects with it also use data-pipeline-design, feature-flag-lifecycle and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Indium-AI-LabsSkilldata-pipeline-design
Design batch or incremental ETL and ELT pipelines and warehouse models: grain, partitioning, idempotent loads, late-arriving data, data quality tests, PII controls, and cost monitoring, before building them. Use when adding or changing a dbt model, warehouse table, scheduled transformation, or ingestion job. Not for transactional schema design (use the database-design skill) or event-sourced stores (use the event-sourcing-architecture skill).
Also in 3 projects that use this
WanbinyuSkillfeature-flag-lifecycle
Manage feature flag add, rollout, and removal. Use when introducing flags or cleaning old flags, or Chinese "特性开关", "feature flag", "灰度", "删 flag". Prevent eternal flags.
Also in 3 projects that use this
PantaniSkillmcp-server-development
Implementation patterns for the ableton-mind TypeScript MCP server: Zod tools, resources, prompts, bridge client, verify loop, transactions and idempotency.
Also in 3 projects that use this
harrissohail6Skillci-cd-pipelines
CI/CD pipeline design and implementation. Auto-activates when discussing deployment, automation, or pipelines.
Also in 3 projects that use this
ffsshhttiikkSkillquery-optimization
Database query optimization
Also in 3 projects that use this
dkprogSkilldependency-management
Apply when wiring dependencies, integrating external services, or designing interfaces between modules. Ensures loose coupling through dependency injection, interface segregation, and proper abstraction boundaries.
Also in 4 projects that use this
Other versions16 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 16
- kid-sid/claude-spellbook★ 190same name
- Indium-AI-Labs/indium-agentkit★ 18same name
- Ionate-Technologies/indium-agentkit★ 17same name
- robisson/build-like-amazon-agent-skills★ 16same name
- drewid74/ai_skills★ 8same name
- reddygopalkrishna/developer-agent-skills★ 8same name
- pfangueiro/claude-code-agents★ 7same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- AxlZero21/Skills★ 1same name
- jasoncrawford/claude-skills★ 1same name
6 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository172 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- 00-meta-initializationSkill
- chwezi-dev-engineSkill
- ai-agent-commercial-operationsSkill
- ai-agent-compliance-controlsSkill
- ai-agent-governance-and-limitsSkill
- ai-agent-multi-agent-coordinationSkill
- ai-agent-observability-evaluationSkill
- ai-agent-runtime-architectureSkill
- ai-agent-safety-and-red-teamSkill
- ai-agent-tooling-and-hitlSkill
- ai-analyticsSkill
- ai-app-architectureSkill
- ai-cost-and-meteringSkill
- ai-economic-value-engineSkill
- ai-evaluationSkill
- ai-feature-rollout-and-experimentationSkill
- ai-feature-specSkill
- ai-incident-responseSkill
- ai-llm-integrationSkill
- ai-model-gatewaySkill
- ai-observability-and-debuggingSkill
- ai-opportunity-canvasSkill
- ai-prompt-engineeringSkill
- ai-rag-patternsSkill
- ai-securitySkill
- ai-web-appsSkill
- coding-agent-optimizationSkill
- openai-agents-sdkSkill
- android-developmentSkill
- api-design-firstSkill
- distributed-systems-patternsSkill
- ecommerce-platform-audit-requirementsSkill
- graphql-patternsSkill
- microservices-architectureSkill
- system-architecture-designSkill
- validation-contractSkill
- database-design-engineeringSkill
- database-reliabilitySkill
- mysql-engineeringSkill
- postgresql-engineeringSkill
- cicd-pipelinesSkill
- cloud-architectureSkill
- deployment-release-engineeringSkill
- docker-developmentSkill
- kubernetes-platformSkill
- observability-monitoringSkill
- reliability-engineeringSkill
- execution-plan-scriptsSkill
- accounting-engineSkill
- accounting-finance-controllerSkill
- electronic-fiscal-taxingSkill
- multicurrency-and-fxSkill
- avalonia-desktop-developmentSkill
- frontend-architectureSkill
- frontend-performanceSkill
- image-compressionSkill
- nextjs-app-routerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 16 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 33
Read this SKILL.md first, then load only the referenced deep-dive files that the task needs.
- Distinctive: line 41
Prefer deterministic, reviewable steps over tool-specific magic.
- Distinctive: line 76
If credentials or state are unavailable, run static validation and return an unverified plan checklist.
- Very specific: line 157
Never commit terraform.tfstate to Git — it stores secrets in plaintext and creates merge conflicts.
- Distinctive: line 249
When prod must live in a separate AWS account, directory-per-env is mandatory — workspaces share backend credentials.
“Common” is measured: kept by at least 6 in 10 of the 16 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Infrastructure as Code
Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.
<!-- dual-compat-start -->Use When
- Provisioning or changing cloud infrastructure with Terraform or Ansible — modules, remote state, workspaces, AWS patterns, idempotent Ansible roles, GitOps with ArgoCD/Flux, drift detection, Vault secret injection.
Do Not Use When
- Vault PKI, dynamic secrets, or rotation depth is needed — load
cicd-devsecops. - The work is CI/CD pipeline construction around IaC — load
cicd-pipelinesorcicd-pipeline-design. - The work is Kubernetes object authoring (Deployments, Services, Helm charts) — load
kubernetes-platform.
Required Inputs
- Project context, target cloud (or self-managed Debian/Ubuntu), and the concrete change to make.
- Confirm deliverable: design, code, review, migration plan, audit, or runbook.
Workflow
- Read this
SKILL.mdfirst, then load only the referenced deep-dive files that the task needs. - Apply the ordered guidance, decision rules, and acceptance criteria here instead of cherry-picking snippets.
- Make assumptions, risks, and follow-up work explicit when they matter.
Quality Standards
- Outputs are execution-oriented, concise, and consistent with the repository engineering baseline.
- Preserve existing project conventions unless this skill requires a stronger standard.
- Prefer deterministic, reviewable steps over tool-specific magic.
Outputs
- Concrete result fitted to the task: implementation guidance, review findings, ADR-style decisions, templates, or generated artifacts.
- Explicit assumptions, tradeoffs, or unresolved gaps when context is incomplete.
References
references/terraform-modules-state.md— module skeleton, registry conventions, state commands, import, splitting state, backend choice.references/aws-patterns.md— VPC, ECS+ALB, RDS, S3 lifecycle, Terratest.references/ansible-debian.md— inventory, role layout, idempotency patterns, hardening playbook, tags.references/gitops-argocd-flux.md— ArgoCDApplication/ApplicationSet, Flux bootstrap, drift wiring.references/iac-tool-selection-and-delivery.md— load when choosing IaC tool categories, deciding Terraform vs OpenTofu (licence verified 2026-09-24), or designing the PR-plan / protected-apply pipeline and state isolation.
Evidence Produced
| Category | Artifact | Format | Example |
| Release evidence | Infrastructure plan and apply evidence | Plan output plus change record | reviewed diff, policy checks, state backup, apply result, drift check, and rollback |
<!-- dual-compat-end -->Why IaC
Inputs
| Input | Required | Purpose |
| Desired resources and environment | yes | Bound change |
| Existing state and provider versions | yes | Prevent drift damage |
| Identity and approval policy | yes | Set execution boundary |
Capability contract
Author and validate code by default. Apply, destroy, import, state edits, and secret writes require explicit environment authority and a reviewed plan.
Degraded mode
If credentials or state are unavailable, run static validation and return an unverified plan checklist; never simulate apply results.
Decision rules
| Condition | Action |
| Plan replaces stateful resource | Require recovery plan |
| Existing resource lacks state ownership | Import or document exception |
| Secret would enter source or state | Use external secret boundary |
Domain Anti-Patterns
- Editing remote state manually. Fix: use supported commands with backup.
- Applying an unreviewed plan. Fix: approve a saved plan.
- Hardcoding secrets. Fix: inject references at runtime.
- Copying divergent environment modules. Fix: share versioned modules.
- Ignoring drift. Fix: schedule read-only plans.
Snowflake servers — hand-configured, undocumented, irreplaceable — cause outages nobody can recover from. IaC puts environments in version-controlled code, making drift a diffable artifact and rebuilds a routine operation.
§1 Terraform Fundamentals
Terraform's core blocks:
| Block | Role |
terraform | required_providers, required_version, backend. |
provider | Configures a provider (aws, google, kubernetes, helm, vault). |
resource | Declares a managed object (e.g. aws_instance, aws_s3_bucket). |
data | Reads existing infrastructure without managing it. |
variable / output | Input/output contract of a configuration or module. |
locals | Computed expressions reused inside the config. |
module | Composition: include another configuration. |
Pin provider and Terraform versions — a minor provider bump can silently change resource behaviour.
terraform {
required_version = ">= 1.11.0" # S3 native locking (use_lockfile) needs Terraform 1.11+ / OpenTofu 1.10+
required_providers {
aws = { source = "hashicorp/aws", version = "~> 6.0" } # AWS provider 6.x current as of 2026-09-24
}
backend "s3" {
bucket = "acme-tfstate"
key = "envs/prod/main.tfstate"
region = "eu-west-1"
encrypt = true
use_lockfile = true # native S3 locking — preferred
}
}
provider "aws" { region = var.region }
variable "region" { type = string }
variable "environment" { type = string }
variable "project" {
type = string
description = "Project slug used in resource names"
validation {
condition = can(regex("^[a-z0-9-]{3,20}$", var.project))
error_message = "project must be 3-20 chars, lowercase, digits, or hyphens."
}
}
module "network" {
source = "./modules/network"
cidr = "10.20.0.0/16"
environment = var.environment
}
resource "aws_s3_bucket" "assets" {
bucket = "acme-${var.environment}-assets"
tags = { Project = var.project, Environment = var.environment }
}
output "vpc_id" { value = module.network.vpc_id }
output "app_bucket_name" { value = aws_s3_bucket.assets.id }For a full VPC + ECS + RDS + S3 lifecycle example see references/aws-patterns.md.
§2 State Management
Never commit terraform.tfstate to Git — it stores secrets in plaintext and creates merge conflicts. Use a remote backend with locking.
The HashiCorp S3-backend documentation is explicit on locking:
Locking can be enabled via S3 or DynamoDB. However, DynamoDB-based locking is deprecated. To enable S3 state locking directly, use the
use_lockfileargument (set to true).
The legacy dynamodb_table argument requires a table whose partition key is LockID of type String. New configurations should use use_lockfile = true; existing configurations may run both during transition.
Backend choice:
| Backend | When | Locking |
S3 + use_lockfile = true | AWS-hosted, current best practice | Native S3 conditional writes |
S3 + dynamodb_table | Legacy; existing configs | DynamoDB partition key LockID (string) |
| GCS | GCP-hosted projects | Native object generation locking |
| Terraform Cloud / Enterprise | Hosted, team workflows | Built in |
Importing existing infrastructure:
# Bring an existing AWS S3 bucket under Terraform management
terraform import aws_s3_bucket.assets acme-prod-assets
# Then write the resource block to match — terraform plan should show no diff.
terraform state list
terraform state show aws_s3_bucket.assets
terraform state rm aws_s3_bucket.assets # untrack without destroyingSplit state per blast-radius boundary — network/, data/, app/ — and cross-reference outputs through terraform_remote_state. See references/terraform-modules-state.md.
§3 Module Design
A module is a directory of .tf files consumed via module "name" { source = "..." }. Pin to an exact Git tag — main can break you on any push.
Module skeleton:
modules/network/
main.tf # resources
variables.tf # typed, documented inputs
outputs.tf # exported values consumers depend on
versions.tf # required_providers, required_version
README.md # usage example, input/output tableVersioning and registry:
- Tag modules in Git with semver (
v1.2.0); consumers reference by tag. - Public modules consumed via the Terraform Registry use
source = "namespace/name/provider"andversion = "x.y.z". - Registry naming convention:
terraform-<PROVIDER>-<NAME>for module repositories (e.g.terraform-aws-vpc).
module "vpc_git" {
source = "git::https://github.com/acme/tf-modules.git//modules/vpc?ref=v1.2.0"
name = "acme-prod"
cidr = "10.20.0.0/16"
azs = ["eu-west-1a", "eu-west-1b"]
}
module "vpc_registry" {
source = "terraform-aws-modules/vpc/aws"
version = "5.5.1"
# ...
}Composability rule of thumb: a module should do one thing — a network, a database, a service. Avoid the "everything module" — it forces consumers to accept defaults they cannot opt out of. Deeper input/output contract patterns in references/terraform-modules-state.md.
§4 Workspaces and Environments
| Pattern | When to use | Trade-off |
terraform workspace (named workspaces, single backend key path) | Lightweight per-env separation in the same configuration | Easy to apply to the wrong env; small blast radius only. |
Directory per environment (envs/dev, envs/staging, envs/prod) with separate backends | Strong isolation; each env has its own state | More duplication; manage with module composition. |
| Terragrunt-style stacks | Many envs / regions, DRY backend config | Extra tool to learn. |
For production SaaS, prefer directory-per-env with module composition. For small projects, workspaces are fine:
terraform workspace new prod && terraform workspace select prod
terraform apply -var-file="prod.tfvars"locals {
instance_size = {
dev = "t3.micro", staging = "t3.small", prod = "m6i.large"
}[terraform.workspace]
}When prod must live in a separate AWS account, directory-per-env is mandatory — workspaces share backend credentials.
§5 Ansible for Debian/Ubuntu
The Ansible playbook documentation defines the model:
A playbook consists of one or more "plays" in an ordered list. Each play executes part of the overall goal of the playbook, running one or more tasks. Each task calls an Ansible module.
Each play needs hosts (the targeted managed nodes) and at least one task. Plays and tasks execute top-to-bottom; each task runs against all matched hosts before the next task starts.
Minimum nginx role and inventory:
# inventories/prod/hosts.ini
[web]
web1.example.com
web2.example.com
[debian:children]
web
[debian:vars]
ansible_user=deploy
ansible_python_interpreter=/usr/bin/python3# roles/nginx/tasks/main.yml
- name: Ensure nginx is installed
ansible.builtin.apt:
name: nginx
state: present
update_cache: true
cache_valid_time: 3600
- name: Deploy nginx site config
ansible.builtin.template:
src: site.conf.j2
dest: /etc/nginx/sites-available/{{ site_name }}.conf
owner: root
group: root
mode: "0644"
notify: Reload nginx
# roles/nginx/handlers/main.yml
- name: Reload nginx
ansible.builtin.service: { name: nginx, state: reloaded }Idempotency rule: running the playbook ten times leaves the system identical to running it once. Ansible modules are idempotent by default; raw shell commands are not — use ansible.builtin.file, apt, template, systemd, and only fall back to command/shell with explicit changed_when and failed_when.
Variable precedence (most-specific wins): -e > task > block > role > play > host > group > role defaults. Dry-run before prod with ansible-playbook -i inventories/prod site.yml --check --diff.
For role layout, dynamic AWS inventory, dependency declarations, and a baseline Ubuntu hardening playbook (ufw, fail2ban, unattended-upgrades, deploy user, SSH keys), see references/ansible-debian.md.
§6 GitOps — ArgoCD and Flux
The Git repo is the single source of truth; a controller continuously reconciles the live cluster to match.
ArgoCD's documented model:
Argo CD continuously monitors running applications and compares the current, live state against the desired target state (as specified in the Git repo). Applications that deviate from this target configuration are flagged as
OutOfSync.
ArgoCD syncPolicy fields:
| Field | Effect |
automated.enabled | Activate automated sync. |
automated.prune: true | Automatically delete resources removed from Git. |
automated.selfHeal: true | Re-sync when the live cluster state deviates from Git. |
automated.allowEmpty | Permit applications with empty manifests when pruning. |
retry.refresh | Refresh on new revisions during sync retries. |
ArgoCD also supports PreSync, Sync, and PostSync hooks for blue/green and canary rollouts, plus ApplicationSet for multi-cluster fan-out.
Flux is multi-controller and headless:
| Controller | Role |
source-controller | Watches Git/OCI/Helm repositories and produces an artifact for other controllers. |
kustomize-controller | Reconciles Kubernetes resources from Kustomize overlays. |
helm-controller | Ensures the state of the Helm release matches what is defined in the resource, performs a release if this is not the case. |
notification-controller | Manages alerts, events, and outbound webhooks. |
| Image automation controllers | Detect new images and update Git automatically. |
Decision rubric:
| Need | Choice |
| First-class web UI for app teams | ArgoCD |
| Tight Helm + Kustomize integration with separable controllers | Flux |
| Image-update-driven promotion across environments | Flux (image-automation controllers) |
ApplicationSet / multi-cluster fan-out | ArgoCD |
Drift detection: ArgoCD flips Application to OutOfSync natively. For Terraform-managed resources, schedule terraform plan -detailed-exitcode every 6 hours and alert on exit code 2. Concrete manifests, bootstrap commands, and notification wiring live in references/gitops-argocd-flux.md.
§7 Terraform vs Ansible Decision Matrix
| Dimension | Terraform | Ansible |
| Primary purpose | Provisioning cloud resources, declarative with a state file. | Server configuration and change application — procedural-feeling but idempotent modules. |
| Lifecycle model | Plan/apply against state; destroy is first-class. | Run-to-converge; no state file. |
| Best at | "Make these cloud resources exist." | "Make these existing servers look like this." |
| Worst at | Imperative, ordered changes on existing servers. | Tracking desired vs actual state of cloud resources at scale. |
| Idempotency model | State file plus provider plan. | Module-level idempotency checks. |
Rule of thumb: Terraform creates the VPS; Ansible configures it. For Kubernetes, GitOps replaces both — Terraform creates the cluster, ArgoCD or Flux reconciles workloads from Git.
In practice the two cooperate: Terraform creates the EC2 instance and emits its IP into an Ansible inventory; Ansible installs nginx, users, firewall rules.
§8 Secrets at the IaC Boundary
Risks:
- Secrets read by Terraform end up in plaintext inside the state file. Treat the state backend as a sensitive store — encrypt at rest, restrict IAM/ACL access, version the bucket.
sensitive = trueon a variable or output suppresses console echo but does not encrypt state.- Ansible Vault encrypts variable files at rest, but the playbook process sees plaintext at runtime — secure the runner and the SSH path.
Patterns:
| Pattern | Tooling | Notes |
| Pull at apply time from HashiCorp Vault | vault provider in Terraform; community.hashi_vault in Ansible | Centralised rotation; depth in cicd-devsecops. |
| Pull from cloud KMS / Secrets Manager | aws_secretsmanager_secret_version, google_secret_manager_secret_version | Avoids running an additional service. |
| Encrypt-at-rest var files | Ansible Vault, SOPS, age | Useful when there is no Vault yet. |
provider "vault" { address = "https://vault.acme.internal" }
data "vault_generic_secret" "rds" { path = "secret/data/prod/rds" }
resource "aws_db_instance" "primary" {
username = data.vault_generic_secret.rds.data["username"]
password = data.vault_generic_secret.rds.data["password"]
}For Kubernetes workloads use external-secrets-operator so manifests reference a Vault path, not a literal secret:
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata: { name: api-db, namespace: api-prod }
spec:
refreshInterval: 15m
secretStoreRef: { name: vault-backend, kind: ClusterSecretStore }
target: { name: api-db }
data:
- secretKey: password
remoteRef: { key: prod/rds, property: password }For Ansible, run a Vault Agent sidecar that renders secrets into /etc/app/db.env and have a systemd unit source it; the playbook installs the agent, never the secret. Cross-reference: cicd-devsecops covers Vault PKI, dynamic secrets, key rotation, and encryption-at-rest. This skill only handles the IaC entry point.
IaC Repository Layout
infra/
modules/{vpc,rds,ecs}/
envs/
dev/{main.tf,terraform.tfvars}
staging/
prod/
ansible/{roles,playbooks,inventories}/mainmirrors prod — a merge tomainis a production change.- Feature branches target
mainvia PR; CI runsfmt,validate,planon every PR and posts the plan as a PR comment. terraform applyagainst prod runs only frommainafter PR approval, through a protected workflow with manual approval.- Dev and staging apply automatically on merge so feedback cycles stay short.
Companion Skills
cloud-architecture— AWS services Terraform modules target.kubernetes-platform— K8s cluster Terraform often provisions and where GitOps reconciles.cicd-pipelines,cicd-pipeline-design— pipelines that runterraform plan/apply.cicd-devsecops— Vault depth, secret scanning, SBOM, IaC linting (tflint,tfsec,checkov).linux-security-hardening— Ansible roles that harden the OS baseline.
Sources
- Terraform documentation —
developer.hashicorp.com/terraform. - Terraform S3 backend —
developer.hashicorp.com/terraform/language/backend/s3. - Terraform GCS backend —
developer.hashicorp.com/terraform/language/backend/gcs. - Terraform Registry publishing —
developer.hashicorp.com/terraform/registry/modules/publish. - Ansible playbook intro —
docs.ansible.com/ansible/latest/playbook_guide/playbooks_intro.html. - Ansible roles —
docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html. - ArgoCD —
argo-cd.readthedocs.io/en/stable/. - ArgoCD auto-sync —
argo-cd.readthedocs.io/en/stable/user-guide/auto_sync/. - Flux concepts —
fluxcd.io/flux/concepts/. - Terratest —
terratest.gruntwork.io.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

