/everything-copilot-cli:terraform-safe-workflowfrom everything-copilot-cli
Guides safe Terraform/OpenTofu changes: check versions, fmt, init, validate, save a plan, review destroy/replace actions, apply only that plan, and confirm empty plan. Recovers with moved/import blocks.
Ships in everything-copilot-cli. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Infrastructure code fails differently from application code: a wrong change does not throw an
exception, it deletes a database. The plan is the only preview, and state is the only record of what
Terraform manages. This skill keeps every change reviewable through a saved plan and every recovery
inside Terraform's own tools. The commands are the same for OpenTofu (tofu instead of terraform).
.tf files, module inputs, or provider and module versions| Instead of terraform-safe-workflow | Use |
|---|---|
Reviewing .tf files only for security misconfiguration | security-audit |
| Watching the service after the infrastructure change is live | deployment-canary |
| Coordinating a live outage caused by an infrastructure change | incident-response |
| Checking a provider's current arguments and behavior | source-driven-development |
required_version allows.tflock object), because on a backend with locking enabled plan takes the
state lock by default; write access to the state itself only where apply runs (creating a new
workspace's empty state is a write, so do that from the apply role).tf files or variables files under version controlterraform version
terraform init -input=false
terraform validate
terraform fmt -check -recursive
Confirm the backend points at the intended environment (terraform workspace show if workspaces are
used) and that .terraform.lock.hcl is committed. Change provider versions on purpose
(terraform init -upgrade) and in their own change, not as a side effect.
terraform plan -input=false -out=tfplan
terraform show -no-color tfplan > plan.txt
Read the summary line and every resource marked to destroy (-) or replace (-/+, or +/- when
create_before_destroy is set). For each one, say why it is expected. A replace is a delete and a
create of the real object — check what data that resource holds. Only values marked sensitive print
as (sensitive value); other secrets and backend details can appear in plan.txt, and the saved
plan file contains values in plain text. Keep both out of version control and out of public
comments: store them as access-controlled CI artifacts and post only a checked, non-sensitive
summary to the pull request.
moved block from the old address to the new
one, and plan again until the plan shows the move with no destroyimport block, check that the plan shows the import and no
unexpected update or destroy for it, apply, then confirm the next plan is emptylifecycle { prevent_destroy = true } on databases, buckets,
and keys that must never be replaced by accidentterraform apply -input=false tfplan
Applying a saved plan runs exactly what was reviewed. Never run a bare terraform apply in CI and
never pass -auto-approve to a fresh plan; in CI, plan in one job, keep the plan job's whole working
directory (the plan file, .terraform, and .terraform.lock.hcl) as a restricted artifact for the
reviewers, and apply that same plan file in a later job that requires their approval. HashiCorp's
automation guide has the apply job restore that directory at the same absolute path, on the same OS
and CPU architecture; the apply job needs exactly the same Terraform version, the identical provider
binaries available at apply time, and credentials that target the same account.
After apply, terraform plan -detailed-exitcode must exit 0 (no changes). Exit 2 means the plan
succeeded and still has changes — drift, a partial apply, someone else's change, or a provider that
reports late; read the whole plan before deciding which.
State records which real object each address manages; it is not a backup of the infrastructure.
Inspect it with terraform state list and terraform state show, and fix addresses with moved
or import blocks. Do not roll state back to an older version because a resource is missing —
that can orphan or duplicate real objects. Keep the current state (and any errored.tfstate),
compare it with what actually exists, then import, recreate, or run terraform plan -refresh-only.
Restore an earlier state version only to undo damage to the state itself — a corrupt or lost file,
or a mistaken state rm/state mv — after confirming which version was correct, under the
backend's lock. Run terraform force-unlock LOCK_ID only for a lock your own failed run left behind, after
confirming its ID and that nothing else is writing.
| Rationalization | Reality |
|---|---|
| "The plan was fine yesterday" | State and remote resources change; apply the plan you just reviewed |
| "It's only a rename" | Without a moved block, a rename is a destroy and a create |
| "I'll fix the state file by hand" | Hand edits bypass locking and versioning; use state subcommands or blocks |
| "Auto-approve is fine in CI" | Then nobody reviewed the destroy lines; gate apply on the saved plan |
-auto-approve, -target, or -lock=false in routine scripts.terraform.lock.hcl missing from version control*.tfvars files committed to the repositoryterraform fmt -check -recursive and terraform validate passterraform plan -detailed-exitcode exits 0 after applyIf apply fails partway, do not run apply again blindly: keep the state it left, plan again, compare the new plan with the reviewed one, and recover missing or extra objects with import or a reviewed follow-up plan rather than by rewinding state.
tflint and checkov or trivy config catch provider-specific mistakes and misconfiguration
before planWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub drvoss/everything-copilot-cli --plugin everything-copilot-cli115 skills in this plugin
/actions-debuggingUse when a GitHub Actions workflow fails — diagnose the run log, identify the root cause, and apply a targeted fix/add-to-changelogUse when you've shipped a feature, fix, or breaking change and need to update CHANGELOG.md — follows Keep a Changelog format and syncs version numbers across package manifests./agent-governanceUse when designing or reviewing an AI agent system that needs policy-based access controls, intent classification, tool-level rate limiting, trust scoring for multi-agent workflows, or append-only audit trails.
Other plugins' skills for the same job