- Home
- Skills
- DevOps & Cloud
- Terraform Review, Design & Migration
Terraform Review, Design & Migration
Managing infrastructure-as-code often leads to fragile state files, unpinned dependencies, and accidental resource destruction during refactors.
$5
Works with the AI Agents you already use
Terraform Review, Design & Migration
Example session with this skill installed
Review the Terraform in this repo. I want to know how good it is and what's wrong with it.
- Read your context and instructions
- Compiled the terraform review design
A real, unedited Review-mode run of this skill on a seeded test repository: orders-infra is a fictional AWS codebase with dev and prod roots, RDS databases and a GitHub Actions apply job.
orders-infra: Terraform review
Mode: Review, at the codebase tier (steps R1 to R4). Rubric v1.0. Nothing was changed, and no backend was touched.
Source: the working tree as of 2026-11-03. The repo is not a git checkout, so there is no commit to cite.
Tooling found in the code: Terraform. Neither root constrains the version; the app module asks for >= 1.6. The provider is hashicorp/aws, unconstrained in the roots and >= 5.40 in the module. Both roots use an S3 backend. There is no wrapper (no Terragrunt or Atlantis). CI is GitHub Actions with hashicorp/setup-terraform@v3, and no Terraform version is set there either.
Redaction: the committed credentials are listed below by kind and location only. Their values are not copied anywhere in this review.
Bottom line
Score: 2.0 out of 10, "Critical / unsafe" (4.0 before the severity caps). The gate fails on every condition.
There are 4 Critical findings and 14 High. The module code is reasonably tidy. The problems are in how the repo handles state, secrets and the path from a commit to an apply. These are the five that matter most:
Dev and prod write to the same state file. Both roots use the same bucket and the same key (orders/terraform.tfstate). Applying dev therefore plans against prod's resources. Changing the RDS identifier forces a replacement. Prod also has deletion_protection = false and skip_final_snapshot = true. Together, that means one terraform apply in envs/dev can destroy all three prod databases and leave no snapshot.
2.
Credentials are committed in plaintext. A static AWS access key pair sits in the prod provider block, and the prod RDS master password is in envs/prod/terraform.tfvars. Both need to be
rotated, not just deleted, because git history keeps them.
3. The prod Postgres port is open to 0.0.0.0/0. The rule is labelled "Temporary".
4.
The state backend has no locking and no encryption setting. That state holds the prod DB password in plaintext, and dev users share it.
5.
Prod is applied with no review. CI runs apply -auto-approve on every push to main. There is no plan on the PR, no saved plan, no approval step and no static checks. The CI job uses long-lived keys, and the README tells people to apply prod from their laptops using "shared deploy credentials".
R1: Inventory
Roots: envs/dev and envs/prod.
Child modules defined in the repo: modules/app.
No root calls it. Both roots call git::https://github.com/acme/terraform-modules.git//app?ref=main instead.
Resources by block:
| Location | Resources |
|---|---|
| dev | aws_security_group.db, one ingress rule, aws_db_instance.db (count = 3) |
| prod | aws_security_group.db, two ingress rules, aws_db_instance.db (count = 3) |
modules/app | one SG, one ingress rule, one egress rule |
State map
| Root × env | Backend | Bucket / key | Lock | Encrypt | Who applies |
|---|---|---|---|---|---|
| envs/dev | s3, eu-west-1 | acme-orders-tfstate / orders/terraform.tfstate | ❌ none | ❌ not set | Humans from laptops (there is no CI job) |
| envs/prod | s3, eu-west-1 | acme-orders-tfstate / orders/terraform.tfstate (the same key) | ❌ none | ❌ not set | CI on every push to main (static keys, -auto-approve); also humans with "shared deploy credentials" (README:15) |
There are two roots but only
one physical state. No root reads another's state (there is no terraform_remote_state). The VPC IDs are hard-coded in tfvars.
Module graph
| Caller | Module | Version |
|---|---|---|
| envs/dev | acme/terraform-modules//app (git) | ?ref=main (a branch, so unpinned) |
| envs/prod | acme/terraform-modules//app (git) | ?ref=main (a branch, so unpinned) |
| none | ./modules/app (local) | orphaned |
Nesting depth is 1 and fan-in is 2. Both edges are unpinned.
In-scope object counts (score weights)
| Domain | Count | What is counted |
|---|---|---|
| structure | 3 | 2 roots and 1 module |
| state | 2 | |
| dependencies | 8 | core and aws constraints for each of 3 modules, plus 2 module calls |
| security | 15 | 2 provider auth blocks, CI auth, 2 DB security groups, 3 DB rules, 3 module SG resources, 2 RDS blocks, 2 password variables |
| change-safety | 2 | RDS blocks covering 6 instances; the saved-plan criterion is counted per root |
| delivery | 2 | |
| Total | 32 |
R2: Static tools
| Tool | Result |
|---|---|
terraform fmt -check -recursive (v1.16.4) | ✅ clean |
terraform init -backend=false && validate, modules/app | ✅ "The configuration is valid." |
terraform init -backend=false, envs/dev and envs/prod | ⚠️ Could not finish: the module source github.com/acme/terraform-modules is private or unreachable from here. The roots were therefore not validated. |
| tflint, checkov, trivy, tfsec, terrascan, gitleaks | Not installed, so not run |
The tool runs were done on a scratch copy, so no .terraform/ directory was written into the repo.
R3: Findings
Confidence tags
- ✅ provable from the code
- ⚠️ a proxy that needs judgement
- 🔬 needs cloud or state data; listed separately and not scored
Critical
| ID | Object | Anti-pattern | Conf. | Theory | Severity | Evidence |
|---|---|---|---|---|---|---|
| TF-SEC-01 | envs/prod provider aws | Static AWS credential in code: an AKIA… access key ID and its secret key as literals | ✅ | T15 (no secrets in code), T14 (short-lived credentials) | Critical | envs/prod/main.tf:3 (access key ID), envs/prod/main.tf:4 (secret access key) |
| TF-SEC-02 | envs/prod db_password | Prod RDS master password committed as a literal in tfvars | ✅ | T15 | Critical | envs/prod/terraform.tfvars:3 (database master password) |
| TF-SEC-03 | aws_vpc_security_group_ingress_rule.db_vendor | Postgres port 5432 open to 0.0.0.0/0 on the prod DB security group. It is marked "Temporary", but nothing makes it expire. | ✅ | T16 (defaults fail closed) | Critical (data port). Whether it is actually reachable depends on the RDS subnets and publicly_accessible, which is unset and defaults to false (🔬 F-4). | envs/prod/main.tf:28-35 |
| TF-STA-01 | Both roots | Prod and non-prod share one state: same bucket and same key | ✅ | T7 (blast radius, one state per environment), T5 | Critical. The rubric's baseline for this is High. It is raised here because, combined with TF-CHG-01 and TF-CHG-02, it is a concrete path to destroying prod data (see the walkthrough below). | envs/dev/backend.tf:3-4, envs/prod/backend.tf:3-4 |
Why TF-STA-01 is Critical. Suppose the state currently holds prod and someone runs envs/dev (a human, because the README tells them to).
- Every address is the same:
aws_security_group.db,aws_db_instance.db[0..2],module.app.*. - In dev,
identifierbecomesorders-dev-*,name_prefixchanges andvpc_idchanges. All three force replacement. - So the plan is to
destroy the three prod RDS instances and create three dev ones. Prod has skip_final_snapshot = true and deletion_protection = false (envs/prod/main.tf:54-55), so nothing stops this and no snapshot is kept.
db_vendoris not in the dev code, so it is destroyed as well.- The next push to
mainthen auto-applies prod over the dev state. That destroys the dev databases with no prompt.
If dev and prod are in
different AWS accounts, refresh instead fails to find the prod objects and drops them from state. Prod is then orphaned, and the next prod apply collides with it on identifiers (🔬 F-3).
There is a second problem. The prod DB password is stored in plaintext in this shared, unencrypted state, so anyone who can read dev state can read the prod password.
High
| ID | Object | Anti-pattern | Conf. | Theory | Severity | Evidence |
|---|---|---|---|---|---|---|
| TF-STA-02 | Both state units | S3 backend without locking (neither use_lockfile nor dynamodb_table). CI and laptops can apply at the same time against the one shared key. | ✅ | T6 | High | envs/dev/backend.tf:2-6, envs/prod/backend.tf:2-6 |
| TF-STA-03 | Both state units | encrypt is not set on the S3 backend, and the state holds the prod DB password. The bucket itself is defined outside this repo (🔬 F-1). | ✅ | T6, T5, T15 | High | same lines |
| TF-DEP-01 | envs/dev, envs/prod | Neither required_version nor required_providers in either root. CI installs whatever setup-terraform@v3 resolves to (no terraform_version). The aws provider floats to any major. | ✅ | T11, T2 | High | No versions.tf or terraform {} version block in envs/*; .github/workflows/terraform.yml:18 |
| TF-DEP-03 | module "app" in both roots | Git module pinned to a branch (?ref=main). Any commit to the modules repo changes prod on the next CI run, and CI applies with -auto-approve. | ✅ | T11 | High | envs/dev/main.tf:14, envs/prod/main.tf:16 |
| TF-SEC-04 | variable "db_password" (both roots) | Secret variable without sensitive = true. It comes from plain tfvars or an interactive prompt rather than a secret store, and RDS-managed master passwords are not used. | ⚠️ (name proxy, confirmed by reading) | T15 | High | envs/dev/variables.tf:11-14, envs/prod/variables.tf:11-14 |
| TF-SEC-05 | aws_db_instance.db (prod) | Prod RDS has no encryption at rest (storage_encrypted is absent and the provider default is false). Dev sets it to true, so this is drift between environments. Turning it on later forces replacement. | ✅ | T16 | High | envs/prod/main.tf:45-57 (compare envs/dev/main.tf:42) |
| TF-SEC-06 | CI job apply; README | Automation uses long-lived static IAM keys (AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY stored as repo secrets) instead of GitHub OIDC with a role. Humans share the same "deploy credentials". | ✅ | T14 | High | .github/workflows/terraform.yml:13-15, README.md:15 |
| TF-STR-01 | envs/dev vs envs/prod | Copy-pasted environments that have already drifted on security and stateful resources: storage_encrypted only in dev; deletion_protection, the vendor rule and static creds only in prod. | ✅ (diffed) | T10, T21 | High | envs/dev/main.tf vs envs/prod/main.tf (lines 33-45 vs 45-57, 28-35, 3-4) |
| TF-CHG-01 | aws_db_instance.db (both roots) | Index-keyed stateful collection: count = length(var.databases) with var.databases[count.index]. Removing "invoices" shifts audit from [2] to [1]. The plan then renames it, which forces replacement, and the audit database is destroyed. | ✅ | T8 | High. Escalates to Critical if the databases list is edited regularly; prod has no protection. | envs/dev/main.tf:34-35, envs/prod/main.tf:46-47 |
| TF-CHG-02 | aws_db_instance.db (prod) | Unprotected prod database: deletion_protection = false, skip_final_snapshot = true, no prevent_destroy | ✅ | T17 | High | envs/prod/main.tf:54-55 |
| TF-CHG-03 | envs/prod (CI) | Plan bypassed: terraform apply -auto-approve, no saved plan, nobody ever sees a plan | ✅ | T12 | High | .github/workflows/terraform.yml:20 |
| TF-DEL-01 | envs/dev, envs/prod | Applied from laptops. Dev has no CI path at all, and the README tells people to apply prod by hand with shared credentials "for an urgent change". | ✅ | T13 | High | README.md:6-15; the workflow only covers envs/prod (terraform.yml:12) |
| TF-DEL-02 | Both roots | No plan is visible before merge: the workflow triggers only on push to main, with no pull_request job | ✅ | T12 | High | .github/workflows/terraform.yml:3-5 |
| TF-DEL-03 | Both roots | No promotion path. CI applies prod only; dev is never applied by the pipeline, so nothing tests a change before prod. Prod has no environment: protection or approval step. | ✅ | T13, T21 | High | .github/workflows/terraform.yml:7-20 |
Medium and Low
| ID | Object | Anti-pattern | Conf. | Theory | Severity | Evidence |
|---|---|---|---|---|---|---|
| TF-DEP-02 | Both roots | Lockfile not committed: .terraform.lock.hcl is gitignored, so there is no provider checksum verification | ✅ | T11 | Medium | .gitignore:5 |
| TF-CHG-04 | aws_db_instance.db (dev) | Dev databases have no destroy protection and skip_final_snapshot = true. Through TF-STA-01, a dev apply operates on the same addresses as prod. | ✅ | T17 | Medium | envs/dev/main.tf:43 |
| TF-DEL-04 | Pipeline | No static checks: no fmt, validate, tflint or security scanner in CI, and no pre-commit config | ✅ | T19 | Medium | .github/workflows/terraform.yml (whole file) |
| TF-DEL-05 | modules/app | Reusable module with no examples/ or *.tftest.hcl | ✅ | T19 | Medium | modules/app/ |
| TF-STR-02 | modules/app vs the remote acme/terraform-modules//app | Two sources of truth. The local module is called by nothing, while the roots consume a remote copy at main. Whether they match is 🔬 (F-5). | ⚠️ | T10, T22 | Medium | envs/*/main.tf source lines; modules/app/ |
| TF-STR-03 | modules/app var.instance_count | Over-exposed interface: the variable is declared but no resource uses it. Prod sets instance_count = 4, which has no effect. | ✅ (local copy) | T9, T22 | Low | modules/app/variables.tf:21-25, envs/prod/main.tf:20 |
What is working well (worth keeping)
The module interface. Every variable has a type and a description. environment has no default and has a validation block. The output references a resource attribute rather than echoing an input. There is a README. (T9)
The module's version constraints. It declares required_providers with a >= minimum and configures no provider, which is right for a shared module. (T9, T11)
Fail-closed network design in the module. Ingress is limited to the LB subnet on 8080. Egress is limited to 443 and has a description. The rule resources are standalone (aws_vpc_security_group_*_rule), not inline. The SG uses name_prefix with create_before_destroy. (T16, T17)
default_tagswith Service, Environment and Owner in both providers. (T16)- Remote S3 backend with
.gitignoreexcluding*.tfstate*,.terraform/andcrash.log. (T5) - Declarative throughout. No provisioners and no
null_resource. (T4) - Formatting.
fmtis clean. - Dev RDS sets
storage_encrypted = true.
🔬 Needs-data flags (not scored)
| # | Question | Why it matters |
|---|---|---|
| F-1 | Does acme-orders-tfstate have versioning, default SSE, public access block and restrictive bucket policy? | It is the only undo for a bad state write, and the state contains the prod password |
| F-2 | Is the committed access key active? What principal is it, what can it do, and does CloudTrail show use from unexpected sources? | Sets how urgent the rotation is and the scope of any incident |
| F-3 | Are dev and prod in the same AWS account? | Decides whether TF-STA-01 shows up as prod destruction or as orphaned prod state |
| F-4 | Which subnets do the prod RDS instances use, and are they publicly reachable? No db_subnet_group_name is set, so the default subnet group is used, which may not even be in var.vpc_id. | Decides whether TF-SEC-03 can be exploited today |
| F-5 | Does acme/terraform-modules//app@main match the local modules/app? | TF-STR-02 |
| F-6 | Which environment does orders/terraform.tfstate currently map, and do its version history entries show dev and prod applies alternating? | Shows whether TF-STA-01 has already caused damage |
| F-7 | What permissions do the CI IAM user and the "shared deploy credentials" have, and who holds them? | TF-SEC-06, TF-DEL-01 |
| F-8 | What is the backup retention on the prod RDS instances as deployed? backup_retention_period is not set in code. | Whether there is any recovery point if TF-CHG-01 or TF-CHG-02 fires |
| F-9 | Is the prod RDS actually unencrypted as deployed? | TF-SEC-05 |
That is 9 flags against 32 objects, or 28%.
R4: Scores
Scoring rules (from scoring.md):
Points per criterion, where p is the fraction of in-scope objects that meet it: 2 if p ≥ 0.95, 1 if 0.50 ≤ p < 0.95, 0 if p < 0.50.
- Base =
(Σ points / (2 × criteria)) × 10. - Caps: any open Critical caps the domain at 2.0; any open High caps it at 6.0.
- N/A: a criterion that cannot apply is left out of the count.
structure: 6.0
Objects: dev, prod, modules/app.
| # | Criterion | Sat / scope | p | Pts |
|---|---|---|---|---|
| 1 | Conventional layout with README or entry point | 3/3 | 1.00 | 2 |
| 2 | Shared across environments, not copied (roots) | 0/2 | 0.00 | 0 |
| 3 | Deep module, nesting ≤ 2 | 3/3 | 1.00 | 2 |
| 4 | Providers configured only at roots | 3/3 | 1.00 | 2 |
| 5 | Typed and described variables, no env defaults, no unused inputs | 2/3 | 0.67 | 1 |
| 6 | No imperative provisioning | 3/3 | 1.00 | 2 |
| 7 | Environments differ only by inputs | 0/2 | 0.00 | 0 |
Base = 9/14 × 10 = 6.4. Cap: High (TF-STR-01) gives 6.0. Score 6.0.
state: 2.0
Objects: dev, prod.
| # | Criterion | Sat / scope | p | Pts |
|---|---|---|---|---|
| 1 | Remote backend | 2/2 | 1.00 | 2 |
| 2 | Locking | 0/2 | 0.00 | 0 |
| 3 | Encrypted and versioned (encrypt ✅ missing; versioning 🔬) | 0/2 | 0.00 | 0 |
| 4 | Isolated per env, prod writable only by the pipeline | 0/2 | 0.00 | 0 |
| 5 | One lifecycle per state (content) | 2/2 | 1.00 | 2 |
| 6 | Narrow cross-state reads | N/A (no cross-state reads) | ||
| 7 | State and .terraform/ excluded from VCS | 2/2 | 1.00 | 2 |
Base = 6/12 × 10 = 5.0. Cap: Critical (TF-STA-01) gives 2.0. Score 2.0.
dependencies: 2.0
| # | Criterion | Sat / scope | p | Pts |
|---|---|---|---|---|
| 1 | Core version constrained (per root) | 0/2 | 0.00 | 0 |
| 2 | Provider version constrained (provider × module) | 1/3 | 0.33 | 0 |
| 3 | Lockfile committed (per root) | 0/2 | 0.00 | 0 |
| 4 | Module source pinned | 0/2 | 0.00 | 0 |
| 5 | Module source trusted (internal acme org) | 2/2 | 1.00 | 2 |
Base = 2/10 × 10 = 2.0. Cap: High gives 6.0. Score 2.0.
security: 2.0
| # | Criterion | Sat / scope | p | Pts |
|---|---|---|---|---|
| 1 | No credential literal (2 providers, CI, 2 password vars) | 3/5 | 0.60 | 1 |
| 2 | Secret vars sensitive and from a secret store | 0/2 | 0.00 | 0 |
| 3 | IAM specific | N/A (no IAM resources) | ||
| 4 | Automation uses short-lived creds (CI, prod provider, dev provider per README) | 0/3 | 0.00 | 0 |
| 5 | Not publicly exposed unless intended (5 rules, 2 RDS) | 6/7 | 0.86 | 1 |
| 6 | Encrypted at rest (2 RDS) | 1/2 | 0.50 | 1 |
| 7 | Module defaults fail closed | 1/1 | 1.00 | 2 |
| 8 | Tagged via default_tags | all/all | 1.00 | 2 |
Base = 7/14 × 10 = 5.0. Cap: Critical (TF-SEC-01, -02, -03) gives 2.0. Score 2.0.
change-safety: 3.3
Objects: 2 RDS blocks; criterion 7 is counted per root.
| # | Criterion | Sat / scope | p | Pts |
|---|---|---|---|---|
| 1 | Stable for_each keys | 0/2 | 0.00 | 0 |
| 2 | moved/import/removed for address changes | N/A (not a PR review) | ||
| 3 | Destroy protection appropriate to the environment | 0/2 | 0.00 | 0 |
| 4 | Backup or final snapshot | 0/2 | 0.00 | 0 |
| 5 | ignore_changes only with a reason | 2/2 | 1.00 | 2 |
| 6 | No unguarded data-source fan-out | 2/2 | 1.00 | 2 |
| 7 | Applied only from a saved, reviewed plan | 0/2 | 0.00 | 0 |
Base = 4/12 × 10 = 3.3. Cap: High gives 6.0. Score 3.3.
delivery: 0.0
All seven criteria score 0:
- static checks 0/2
- plan before merge 0/2
- apply from a saved plan in CI 0/2
- prod gated with a short-lived identity 0/1
- promotion non-prod first 0/2
- policy checks 0/2
- scheduled drift detection 0/2
Base = 0/14 × 10 = 0.0. Score 0.0.
Codebase
| structure | state | dependencies | security | change-safety | delivery | Codebase |
|---|---|---|---|---|---|---|
| 6.0 | 2.0 | 2.0 | 2.0 | 3.3 | 0.0 | 2.0 |
| (w = 3) | (w = 2) | (w = 8) | (w = 15) | (w = 2) | (w = 2) |
Weighted mean of domain scores: (3·6.0 + 2·2.0 + 8·2.0 + 15·2.0 + 2·3.3 + 2·0.0) / 32 = 74.6 / 32 = 2.33. Re-applying the Critical cap gives
2.0, which is in the
Critical / unsafe band.
Uncapped (weighted mean of the bases): (3·6.43 + 2·5.0 + 8·2.0 + 15·5.0 + 2·3.33 + 2·0.0) / 32 = 127.0 / 32 =
4.0. Even with no caps at all, this would be "Poor".
Severity tally: 4 Critical · 14 High · 5 Medium · 1 Low. 🔬 flags: 9.
Gate: NOT good enough (every condition fails)
| Condition | Result | Reason |
|---|---|---|
| Capped score ≥ 9.0 | ❌ | 2.0 |
| No open Critical or High | ❌ | 4 Critical, 14 High |
| Every prod state unit is remote, locked and isolated from non-prod | ❌ | Remote, but no lock (TF-STA-02) and shared with dev (TF-STA-01) |
| Every root reaches apply only through a reviewed, saved plan in a pipeline | ❌ | Prod: -auto-approve with no plan review. Dev: laptops only. Laptop prod applies are documented. |
| 🔬 flags ≤ 10% of objects | ❌ | 9 of 32 (28%) |
Systemic issues
Nobody owns the state boundary (T5–T7). The two environment folders look isolated but write to one state file, with no lock and no encrypt. The directory layout is giving a false sense of isolation, and that is the main risk in this repo.
2. Secrets go through code and state (T14, T15). The issues reinforce each other:
- static provider keys in HCL;
- static keys in CI;
- a shared human credential;
- a plaintext password in tfvars;
- a non-sensitive password variable;
- the result landing in an unencrypted state that dev users share.
No contract between review and apply (T12, T13). No PR plan, no saved plan, no approval step, -auto-approve on push, and no static checks. On top of that, an unpinned module branch (?ref=main) and unpinned providers mean that changes made in other repos flow straight into prod.
4. Copied environments have drifted on exactly the attributes that matter (T10, T21). Encryption, deletion protection, a public ingress rule and credentials all differ between dev and prod. So dev is not a test of prod.
5.
Stateful resources are fragile (T8, T17). The count-indexed databases and the disabled protections each turn an ordinary edit into a potential data loss.
Handoff
Reviewed
orders-infra(working tree, 2026-11-03; no git commit available): score
2.0 (Critical / unsafe; 4.0 uncapped), gate
fail on all five conditions.
4 Critical, 14 High. The state map and module graph are above.
Containment that should not wait for Design. This is operational advice, not a prescribed redesign:
Rotate the committed AWS access key and the prod DB password, then remove them. Git history keeps the old values.
Stop running
terraform applyinenvs/devuntil the shared state key is resolved. The safe split uses separate keys or buckets with a reviewed migration, and must not involve hand edits to state.Review whether the
0.0.0.0/0rule on 5432 should still exist.
Next: run
Design to correct the state, security, dependencies and structure domains (one definition with per-environment state, locking and encryption, secret handling, pinning). Then run
Propose for a no-recreate sequence; for_each migration of the RDS instances uses moved blocks. The apply path (OIDC, PR plans, saved-plan apply, prod approval, promotion) goes to the
pipelines skill.
Connects securely to your tools. The creator never sees your data.
About this skill
Managing infrastructure-as-code often leads to fragile state files, unpinned dependencies, and accidental resource destruction during refactors. This skill audits, designs, and migrates Terraform or OpenTofu codebases against a rigorous scoring rubric and AWS provider best practices. It treats the state file as a first-class citizen to ensure changes remain safe and predictable.
What it does
- Codebase Auditing grades infrastructure across six domains: structure, state, dependencies, security, change-safety, and delivery.
- State Mapping visualizes the relationship between roots, environments, backends, and locking mechanisms to identify blast radius risks.
- Module Graphing tracks caller-to-module relationships including depth, fan-in, and version pinning status.
- Design Planning generates a
design.mddetailing layout, lifecycle grouping, and promotion models before HCL is written. - Migration Sequencing produces no-recreate refactoring plans using
movedandimportblocks to avoid accidental downtime.
How it works
- Review Mode: Analyze existing code or a PR diff to generate evidence-backed findings and a 0–10 score.
- Design Mode: Create or redesign the infrastructure shape based on lifecycle boundaries and state isolation requirements.
- Propose Mode: Sequence a migration plan that addresses critical findings while maintaining resource identity.
Frameworks & tools
Primary support for Terraform and OpenTofu. Signal detection is optimized for the AWS provider, with documented equivalents for Azure (azurerm) and Google (google). Compatible with wrappers like Terragrunt, Terramate, Atlantis, Spacelift, and Terraform Cloud.
Why this beats prompting it yourself
Generic prompts often miss the nuances of state file locking and blast radius analysis. This skill uses a repeatable rubric and 22 core IaC principles to ensure every finding is backed by theory rather than just stylistic preference.
Use cases
- Auditing a legacy monorepo to split a single giant state file into isolated components.
- Reviewing a PR to ensure new modules don't introduce unpinned dependencies or secret leaks.
- Designing a multi-account AWS landing zone with standardized environment promotion patterns.
- Planning a provider upgrade or refactor without triggering resource recreation.
Known limitations
This skill does not run apply, import, or state commands against real backends. It relies on static analysis and user-supplied plan JSON. Signals are most mature for AWS environments.
Does not execute plan or apply against live cloud backends. Requires user-supplied plan JSON for dynamic analysis. Signal detection is primary for AWS; other providers have less coverage.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 14 days ago
Requires