Export an existing resource to Terraform
export_terraformGenerate Terraform (HCL) for EXISTING Control Plane resources from a self link. Single resource (/org/acme/gvc/prod/workload/api) or bulk by path depth — /org/acme exports the whole org, /org/acme/gvc/prod/workload exports every workload in a GVC. Set generateImports to get ready-to-run terraform import commands for adopting the resources into Terraform state, and includeDependencies to pull in referenced resources. Secrets are never exported — a ref that targets secrets is refused, and an export that would pull secrets in is refused wholesale. An unsupported kind is rejected with the supported list (list_terraform_kinds, full profile, enumerates them up front). For an in-memory manifest, use convert_to_terraform. Recommended reading: get_cpln_skill("iac-terraform-pulumi").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resource | Yes | Self link of an existing resource, e.g. `/org/acme/gvc/prod/workload/api` (a full `https://api.cpln.io/org/...` URL is also accepted). Use a shorter path for a bulk export: `/org/acme` (whole org) or `/org/acme/gvc/prod/workload` (all workloads in a GVC). | |
| generateImports | No | Also return the matching `terraform import` commands, one per resource with the import IDs prefilled. Run them after `terraform init` and before the first `terraform apply` so the existing resources are adopted into state instead of re-created. | |
| includeDependencies | No | Also export referenced/dependent resources so the generated HCL is self-contained. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the call succeeded. | |
| data | No | The full machine-readable result — list rows, the resource object, query results. Read THIS, not just the summary. | |
| summary | Yes | One-line summary of the result. | |
| nextSteps | No | Recommended follow-up actions for this task, in order. |