agentsclimarketplace

Terraform import

Skill bmoldo/terraback-plugin/skills/terraform-import

Import existing AWS, Azure, or GCP infrastructure into Terraform using the terraback MCP tools. Use when the user asks to import, codify, adopt, or bring existing cloud resources under Terraform management.From its SKILL.md

Install
npx -y skills add bmoldo/terraback-plugin --skill terraform-import

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.7 KB, as published. Nobody here has run it

Import existing cloud infrastructure into Terraform

Use the terraback MCP tools to inventory live cloud resources, generate Terraform HCL with import blocks, and verify the result with a read-only terraform plan. All six tools are read-only or code-generation-only: none of them import into state, apply, or mutate cloud infrastructure.

Prerequisites (check before starting)

  1. terraback is pip-installed and on PATH - the MCP server is launched as terraback mcp. If the terraback tools are missing, tell the user to pip install terraback and re-add the server.
  2. Read-only cloud credentials are configured in the environment the MCP server runs in (ambient credential chain; tools never take credentials as arguments): AWS ReadOnlyAccess + SecurityAudit, Azure Reader on the subscription, GCP roles/viewer on the project.
  3. terraform >= 1.5 is on PATH - verify_plan runs terraform init + terraform plan, and import blocks require Terraform 1.5+.

Scope semantics

Every provider-facing tool takes provider + scope:

  • aws: scope is a region, e.g. "us-east-1". Optional profile selects a named AWS CLI profile.
  • azure: scope is a subscription ID.
  • gcp: scope is a project ID.

The canonical loop

Follow these steps in order. Confirm provider and scope with the user first.

1. Plan coverage

Call list_supported_resources (optionally with provider) and confirm the resource types the user cares about are supported. Use the returned type names in every later types argument.

2. Inventory

Call scan_infrastructure with provider and scope. Pass types to narrow the scan - it is much faster than scanning everything. The result contains summary.total and summary.counts_by_type. The full resource list is inlined only up to 200 entries; for larger inventories the result instead points at inventory_file - read that JSON file from disk to see individual resources.

3. Target unmanaged resources (optional)

If the user already has Terraform state, call detect_unmanaged with provider, scope, and state_files. v1 reads LOCAL state file paths only - for remote backends (S3, azurerm, GCS, Terraform Cloud), run terraform state pull > state.json first and pass that path. Work only on the unmanaged resources it reports; never touch already-managed ones.

4. Codify

Call codify_batch with provider, scope, types, and an explicit output_dir. Start with a small type subset rather than everything at once. To skip already-managed resources, pass state_files plus exclude_managed: true.

The Community tier caps a single call at 25 total resources. If the tool returns {"error": "resource_cap_exceeded", ...}, nothing was written: narrow the request using types or tag_filters (the error's counts_by_type shows what to cut), or tell the user the Professional tier removes the cap. Use codify_resource for a single known resource ID; it is not capped.

5. Verify

Call verify_plan with terraform_dir set to the output directory. It returns drift ("none", "drift_detected", or "plan_failed") and a summary of imports, adds, changes, destroys.

6. Fix drift until clean

Pending imports are expected and are not drift. Adds, changes, and destroys are problems:

  • Read change_resources / add_resources / destroy_resources from the result, open the corresponding .tf files in output_dir, and fix the specific attributes causing the diff.
  • If drift is "plan_failed", read the returned error output, fix the invalid HCL or provider config, and re-run.
  • Re-run verify_plan after each fix. Repeat until drift is "none".

7. Hand off

Summarize for the user: files written (list the .tf files in output_dir), resource counts by type, and any remaining warnings from the tool results. State clearly that nothing has been imported or applied yet, and give the next command (terraform apply performs the imports).

Rules

  • Never edit the IDs inside generated import blocks - they are the contract between the code and the live resource.
  • Prefer regenerating a resource (codify_resource / codify_batch) over hand-editing whole files; hand-edit only targeted attributes when resolving drift.
  • Never run terraform apply unless the user explicitly asks for it.
  • Do not invent tool parameters - the tool reference at https://docs.terraback.io/mcp-server/tool-reference/ is the authoritative contract.

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.