Import your Terraform stack into CloudBooster
- You need **Organization Admin** or **Project Owner** access in CloudBooster.
Import your Terraform stack into CloudBooster
This guide walks you through importing an existing Terraform-managed infrastructure into CloudBooster using the built-in import wizard. You export your local Terraform state, upload it to CloudBooster, review the proposed resource mappings, and confirm the import so CloudBooster can begin managing everything through GitOps.
This is a hosted-platform (portal) feature, not a CLI command
Importing existing infrastructure happens in the CloudBooster portal. There is no cbx import command, and cbx-cli exposes no state-file import flags. You'll use the Terraform CLI to export state, then upload it through the portal wizard below.
Before you begin
- You need Organization Admin or Project Owner access in CloudBooster.
- You need the Terraform CLI installed locally and access to the working directory that contains the state you want to import.
- The state must be accessible via
terraform state pullfrom your local machine. Remote-state backends (S3, Terraform Cloud, etc.) are not supported by this workflow. - Review the cross-account role security model to understand how credentials and state data are handled.
Sensitive data in state files
Terraform state can contain secrets (passwords, tokens, private keys). Before uploading, review tfstate.json for sensitive values. CloudBooster encrypts state data at rest and in transit, but you should still verify that no plaintext secrets are included in the file you upload.
Step 1 — Export Terraform state
Open a terminal in the Terraform working directory you want to import.
- Ensure you are in the correct workspace:
- Export the current state to a local JSON file:
- Verify the file was created and contains resources:
The tfstate.json file now contains a snapshot of every resource tracked by Terraform in this workspace.
Step 2 — Upload
Open the import wizard from the CloudBooster portal: Projects → Import → Terraform Stack.
- Choose the target project (or create a new one).
- Select Terraform as the source.
- Drag and drop
tfstate.jsoninto the upload area, or click Browse to select it. - Click Upload.
The wizard validates the JSON structure, checks for unsupported provider versions, and begins parsing the resource graph. A progress indicator shows the parsing status.
Step 3 — Review
After the upload completes, the Review Dashboard presents every discovered Terraform resource in a searchable, filterable table.
| Column | Description |
|---|---|
| Resource | Terraform resource type and name (e.g., aws_instance.web_server) |
| Provider | Terraform provider that manages this resource |
| CB Mapping | The CloudBooster resource definition that will manage this asset |
| Status | Mapped, Unmapped, or Conflict |
You can:
- Toggle resources in or out of the import set.
- Override the proposed CB mapping for individual resources.
- Group by provider, resource type, or module path.
- Inspect the raw Terraform configuration block for any resource.
Step 4 — Confirm
When you are satisfied with the mapping, click Confirm import.
CloudBooster:
- Generates Crossplane Claims for every mapped resource.
- Writes the Claims and a Terraform-to-CB mapping manifest to the project's GitOps repository.
- Opens a pull request (if GitOps is configured for review) or applies immediately (if auto-apply is enabled).
- Creates a project snapshot so the import can be rolled back.
You receive a confirmation summary showing the number of resources under management, the GitOps commit SHA, and an estimated reconciliation time.
Step 5 — Manage
After confirmation, your resources appear in the CloudBooster portal as first-class managed assets.
From the project view you can:
- Drift detection: CloudBooster continuously compares the live cloud state with the GitOps Claims and surfaces discrepancies. Drift originating from Terraform runs outside CloudBooster is flagged explicitly.
- Policy enforcement: Apply CB resource policies (e.g., mandatory tagging, encryption requirements).
- Cost insights: See per-resource cost attribution based on cloud provider billing data.
- One-click updates: Modify parameters in the portal UI; CloudBooster generates the updated Claim and pushes it through GitOps.
Sample Terraform state
The walkthrough above was written against the following reproducible Terraform configuration. You can apply this in a sandbox account to refresh the screenshots without changing the narrative.
Workspace: default
Terraform version: ~> 1.9
Providers: hashicorp/aws ~> 5.0
Compute
| Resource | Type | Details |
|---|---|---|
aws_instance.web_server | t3.micro | Amazon Linux 2023, cb-demo-web SG |
aws_launch_template.web | Launch template | AMI ami-0abcdef1234567890, user data installs nginx |
Networking
| Resource | Type | Details |
|---|---|---|
aws_vpc.main | VPC | CIDR 10.0.0.0/16 |
aws_subnet.public_a | Subnet | CIDR 10.0.1.0/24, AZ us-east-1a |
aws_subnet.public_b | Subnet | CIDR 10.0.2.0/24, AZ us-east-1b |
aws_internet_gateway.main | Internet gateway | Attached to aws_vpc.main |
aws_lb.web | Application Load Balancer | Internet-facing, HTTP:80 |
Storage
| Resource | Type | Details |
|---|---|---|
aws_s3_bucket.assets | S3 bucket | Versioning enabled, SSE-S3 |
Database
| Resource | Type | Details |
|---|---|---|
aws_db_instance.main | RDS PostgreSQL 15 | db.t3.micro, storage encrypted |
Security
| Resource | Type | Details |
|---|---|---|
aws_security_group.web | Security group | Ingress 80/443 from 0.0.0.0/0, egress open |
aws_security_group.db | Security group | Ingress 5432 from aws_security_group.web only |
aws_iam_role.ec2_role | IAM role | AmazonSSMManagedInstanceCore attached |
Tags (applied to all resources)
| Key | Value |
|---|---|
Project | cb-terraform-demo |
Environment | sandbox |
ManagedBy | terraform |
What if?
Empty state file
If the upload succeeds but the dashboard shows 0 resources, check the following:
- Workspace mismatch:
terraform state pullexports the state of the currently selected workspace. Switch to the correct workspace withterraform workspace select <name>and re-export. - Local vs. remote state: This workflow only supports local state files exported via
terraform state pull. If your backend is configured to S3, Terraform Cloud, or another remote store, the CLI may still return a local copy, but verify that.terraform/terraform.tfstateor your configured backend is reachable. - State locking: If another process holds the state lock,
terraform state pullmay fail silently or return stale data. Wait for the lock to release and try again. - Resource exclusion: Some resource types (e.g., data sources, null resources) are skipped by default. Expand the Advanced settings panel in the wizard and enable the relevant resource families if you need them imported.
Upload failure
If the upload fails with an error message, the most common causes are:
- Invalid JSON: The file must be a valid Terraform state JSON document (schema version 4). Run
terraform state pull > tfstate.jsonfresh rather than copying.terraform.tfstatedirectly, which may be in a different format. - File too large: State files over 50 MB are rejected to protect upload performance. If your state is larger, consider splitting the project into smaller workspaces or using the
terraform state rmcommand to exclude heavy resources before export. - Unsupported provider: CloudBooster does not yet support every Terraform provider. The wizard lists unsupported providers in the error detail. Remove those resources from the state or open a support request for provider support.
- Network issues: Ensure that
api.cloudbooster.iois reachable from your browser and that no corporate proxy blocks multipart uploads.
Ambiguous mappings
Sometimes CloudBooster discovers a Terraform resource but cannot confidently map it to a single CB resource definition. This is shown as Ambiguous in the Status column.
- Click the resource row to open the mapping panel. CloudBooster lists the candidate definitions with a confidence score.
- Review the schema compatibility: Each candidate shows which parameters can be inferred from the Terraform state and which require manual input.
- Pick the best match or select Skip to leave the resource unmanaged.
- If none of the candidates fit, you can Request a new definition from the CloudBooster support team. Include the resource address (e.g.,
aws_instance.web_server) and a brief description of the desired management behavior.
Secrets in state
Terraform state files can contain plaintext secrets. If the wizard detects values that look like passwords, API keys, or private keys, it surfaces a warning before you confirm the import.
- Review the flagged values in the security panel.
- Rotate any exposed credentials after import is complete. CloudBooster does not store secrets from the state file in GitOps; it replaces them with references to a secrets manager.
- Enable encryption at rest in your CloudBooster project settings if you have not already done so.
Next steps
- Manage imported resources in the CloudBooster portal
- Read the cross-account role security model
- Import your existing AWS account into CloudBooster
- Import a Pulumi stack