terraform-skill
Diagnoses and designs safe Terraform releases, provisioners (remote-exec/local-exec/file, cloud-init, Compose, Caddy), multi-environment isolation, and fresh-host bootstrap
Install / Use
npx skills add daymade/claude-code-skills --skill terraform-skillInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
AutomationSupported Platforms
Our assessment of terraform-skill
terraform-skill scores 93/100 on our quality scale, 677th of 2,780 Automation skills we index (top 25%).
Its SKILL.md is 19 KB long, well organised into 33 sections with 16 code examples: a thorough specification that gives an agent plenty to work with.
With 1,426 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so terraform-skill is actively maintained.
- Our last check on 2026-10-26 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-10-04. Automated pattern scan on 2026-10-04. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
terraform-skill compared with similar skills
All 4 of these similar skills score higher than terraform-skill; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| terraform-skill (this skill)by daymade | 93 | 1.4k | 53d ago | SKILL.md |
| taste-skillby Leonxlnx | 100 | 116.8k | 8d ago | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 112.3k | 9d ago | CLAUDE.md |
| rufloby ruvnet | 100 | 81.9k | today | CLAUDE.md |
| Claude-Code-Game-Studiosby Donchitos | 100 | 39.7k | 7d ago | CLAUDE.md |
Frequently asked questions
- How do I install terraform-skill?
- Run
npx skills add daymade/claude-code-skills --skill terraform-skill. The install tabs above show the steps for each supported agent. - Which AI agents does terraform-skill work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is terraform-skill safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is terraform-skill still maintained?
- The repository was last updated about 2 months ago, so terraform-skill is actively maintained.
Skill content
View source on GitHubname: terraform-skill description: >- Diagnoses and designs safe Terraform releases, provisioners (remote-exec/local-exec/file, cloud-init, Compose, Caddy), multi-environment isolation, and fresh-host bootstrap. Use when writing or reviewing plan/apply wrappers or provisioners; when staging/production config may differ; when a rollout can mutate a shared gateway; or debugging drift, TLS, container restarts, DNS duplication, or snapshot contamination.
Terraform Release and Provisioner Safety
Prevent a valid-looking Terraform workflow from publishing unvalidated bytes or widening a change's blast radius. Keep the user's business outcome and the actual mutation surface ahead of plan counts, green wrappers, or process completeness.
Route the task
- Release, shared gateway, saved plan, staging receipt, or production promotion: read release-safety-and-environment-parity.md.
- Environment isolation, including cached initialization, environment retirement, shared data backend, DNS ownership, state, or snapshots: read multi-env-isolation.md.
- Pre-deploy checks or a validator: read pre-deploy-validation.md.
- Fresh instance or empty data disk: read zero-to-deploy-checklist.md.
- One known provisioner symptom: use the matching pattern below.
Operating contract
- Use the repository's canonical wrapper when it has one. Do not bypass it with a raw Terraform, SSH, SCP, helper-script, or console path because a gate rejects the planned release.
- Prefer provider resources, image baking, cloud-init, or configuration management. HashiCorp recommends exhausting purpose-built alternatives because Terraform cannot model provisioner side effects predictably. When a provisioner remains necessary, make its artifact, target, lock, validation, and readback explicit.
- Inventory every resource or recovery tool that can write the target runtime. A validator attached to only one writer does not protect another writer of the same shared service.
- Give staging and production one required-key schema. Let values differ; never let a key be required in one environment and optional, defaulted, absent, or allowed-empty in another.
- Validate the exact candidate bytes, Compose-rendered environment, and immutable runtime image before the first live write or restart. Keep post-deploy checks too: they detect damage but cannot prevent the first bad mutation.
- Treat a saved plan as an executable artifact. Bind it to reviewed source/artifact identity and apply that exact file. A successful apply is not a staging receipt; record promotion evidence only after every required live verifier succeeds.
- Require an explicit production decision at the last reversible point. A deadline,
PLAN_DIGEST,CONFIRM_*, or agent inference is not production authorization. - Stop after the requested result is verified. Do not turn a single-service fix into full-stack drift reconciliation, recovery redesign, or unrelated hardening.
Provisioner traps (symptom → fix)
Use these incident-derived symptom patterns to choose the next falsifying check. Confirm the current source and runtime before promoting a historical cause into the present diagnosis.
terraform plan says "No changes" but the site is down
Symptom: Browser ERR_SSL_PROTOCOL_ERROR or similar, terraform plan shows No changes, but the service is actually broken.
Root cause: Terraform validates config↔state, not state↔reality. Resources created by null_resource + provisioners (files synced to a server, containers started, etc.) can be modified out-of-band and terraform will never notice. The 80→443 redirect may still work, creating a "half-healthy" illusion.
Diagnosis:
- Check the actual server state, not terraform's opinion (e.g.,
ls /path/on/server, notterraform plan) - Look for signs of out-of-band modification: all files same mtime, source files (
.tftpl,.static) mixed into deployed directories - Compare state-tracked hashes vs live files:
terraform show -json→ extracttriggers.gateway_files_json→ sha256 each file → compare withsha256sumon server
Fix: Force the provisioner to re-run from frozen plan bytes:
TF_CLI_ARGS_plan='-replace=module.<name>.null_resource.<resource>' terraform plan ...
Then apply. The provisioner will rebuild from the plan's frozen bytes, ignoring the corrupted live state.
Prevention: Add a periodic job that compares state-tracked file hashes against live server files. Terraform alone will never catch this.
Staging applies cleanly but production fails port is already allocated
Symptom: Compose deploy passes staging verification, then the production apply dies at docker compose up with Bind for 127.0.0.1:<port> failed: port is already allocated.
Root cause: Staging/production parity covers configuration, not host port allocation. The staging host does not run the colliding service (2026-10-01: 3001 was free on staging, occupied by lobe-new-api on the production gateway). A tainted null_resource is left behind, so the retry must go through the replace flow (CONFIRM_REPLACE), not a plain re-apply.
Diagnosis:
ssh root@<target-host> 'ss -ltnp | grep <port>' # find the real occupant
docker ps --format "{{.Names}} {{.Ports}}" | grep <port>
Prevention: Before binding a host port in a module, check the target host for the exact bind at design time — never infer freeness from staging. Prefer uncommon high ports, record the allocation in the module comment and the deploy doc, and when a container needs a host-local probe target remember 127.0.0.1 inside a container is the container itself: host-local targets belong to host-level probes (systemd scripts), not containerized monitors.
docker: not found in remote-exec
cloud-init still installing Docker when provisioner SSHs in.
provisioner "remote-exec" {
inline = [
"cloud-init status --wait",
"command -v docker >/dev/null || { echo 'FATAL: Docker not ready'; exit 1; }",
]
}
rsync: connection unexpectedly closed in local-exec
Do not infer a universal Terraform limitation from this symptom. A second SSH client can lose to the
target's connection budget, SSH policy, or a competing deploy. Keep local-exec local: package an
immutable artifact there, then use a Terraform-managed upload or a purpose-built deploy system. Give
every apply a unique remote staging path; never share /tmp/src.tar.gz across concurrent applies.
provisioner "local-exec" {
command = "tar czf /tmp/src-${self.id}.tar.gz --exclude=node_modules --exclude=.git -C ${path.module}/../../.. myproject"
}
provisioner "file" {
source = "/tmp/src-${self.id}.tar.gz"
destination = "/tmp/src-${self.id}.tar.gz"
}
provisioner "remote-exec" {
inline = ["tar xzf /tmp/src-${self.id}.tar.gz -C /data/ && rm -f /tmp/src-${self.id}.tar.gz"]
}
macOS BSD tar: --exclude must come BEFORE the source argument.
cloud-init status shows "running" forever
apt-get -y does not suppress debconf dialogs. Packages like iptables-persistent block on TTY prompts.
- |
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | debconf-set-selections
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | debconf-set-selections
DEBIAN_FRONTEND=noninteractive apt-get install -y iptables-persistent
Known offenders: iptables-persistent, postfix, mysql-server, wireshark-common.
EACCES: permission denied in container logs, container Restarting
Host volume dirs are root-owned; container runs as non-root (uid 1001). Fix before docker compose up:
mkdir -p /data/myapp/data /data/myapp/logs
chown -R 1001:1001 /data/myapp/data /data/myapp/logs
Find UID: grep adduser.*-u or USER in Dockerfile.
Provisioner fails but no diagnostic output
Keep fail-fast behavior; attach diagnostics to failure instead of disabling set -e. Otherwise an
early failed command can be overwritten by a later green health check.
provisioner "remote-exec" {
inline = [
"set -eu",
"trap 'rc=$?; if [ $rc -ne 0 ]; then docker logs myapp --tail 20 2>&1 || true; docker ps --format \\\"table {{.Names}}\\\\t{{.Status}}\\\" || true; fi; exit $rc' EXIT",
"docker compose up -d",
"sleep 15",
"docker ps --filter name=myapp --format '{{.Status}}' | grep -q healthy || exit 1",
]
}
Failed to save state / Failed to persist state to backend after apply
The apply ran and only the final backend upload failed (a timeout to the state bucket is typical).
First confirm that in the apply log: every resource reports Creation complete,
Modifications complete or Destruction complete, and the only errors are these two. Then every side effect already
happened — provisioners ran, remote writes landed, containers were recreated — but the backend still
holds the previous state, and Terraform wrote the new one to errored.tfstate in the directory it
ran in (for a wrapper, its root module directory, not your shell's). Do not re-run apply: it would
work from the stale state, which Terraform itself warns forks the state, and resources the failed
run already created or replaced would be created or replaced again.
Run the recovery from that directory, through the repository's wrapper when it passes state
subcommands through (operating contract 1); otherwise in exactly the environment the wrapper sets
up, so the same backend and credentials are used. Keep the pulled copies out of the repository:
terraform state pull > "${TMPDIR:-/tmp}/remote.json"
jq '{file: input_filename, lineage, serial}' "${TMPDIR:-/tmp}/remote.json" errored.tfstate
# expect: identical lineage, and the remote serial lower than errored.tfstate's
terraform state push errored.tfstate
terraform state pull | jq '{lineage, serial}'
# expect: serial higher than the remote's before the push (it need not equal
# errored.tfstate's; the backend may increment it). Then check the resources the
# apply created or replaced: `terraform state show <address>` carries the IDs in the apply log.
state push refuses an unrelated lineage, a newer remote serial, and an equal serial with different
content (observed on Terraform 1.5.7 with a local backend). A refusal means the remote no longer
matches this errored.tfstate — another writer changed it, the file is left over from an older run,
or you are pointed at a different workspace or backend: stop and reconcile. Never add -force; it overwrites whatever the
remote holds. If the push fails on the same transport error as the apply, retry it later;
errored.tfstate stays usable until the remote serial moves. After a successful push, move
errored.tfstate out of the working directory (to scratch space) so it is not later read as live
state; it and the pulled copies hold the full state, secrets included, so delete them once the
read-back passes. Then read the wrapper's recipe and run by hand every step that follows its apply command —
persisting the new setting, post-apply verification. The wrapper's failure exit hides that the
remote change is already live.
Container Restarting — database tables missing
DB migrations not in provisioner. PostgreSQL docker-entrypoint-initdb.d only runs on empty data dir. Explicitly create DB + run migrations:
# After postgres healthy:
docker exec pg psql -U postgres -tc "SELECT 1 FROM pg_database WHERE datname='mydb'" | grep -q 1 \
|| docker exec pg psql -U postgres -c "CREATE DATABASE mydb;"
# Idempotent migrations:
for f in migrations/*.sql; do
VER=$(basename $f)
APPLIED=$($PSQL -tAc "SELECT 1 FROM schema_migrations WHERE version='$VER'" | tr -d ' ')
[ "$APPLIED" = "1" ] &&
Truncated for display — read the full file on GitHub.
Related Skills
taste-skill
116.8kAgent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages
Agent-Reach
112.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
ruflo
81.9k🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
Claude-Code-Game-Studios
39.7kTurn Claude Code into a full game dev studio — 49 AI agents, 72 workflow skills, and a complete coordination system mirroring real studio hierarchy.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
