> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ubiquex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# ubx convert

> Convert Terraform or Pulumi code to ubx .iac files.

`ubx convert` converts existing Terraform HCL or Pulumi TypeScript/Python/Go files to ubx `.iac` format.

## Usage

```bash theme={null}
ubx convert --from <source> [path] [flags]
```

## Supported Sources

| Source                  | Flag               |
| ----------------------- | ------------------ |
| Terraform HCL           | `--from terraform` |
| Pulumi TypeScript       | `--from pulumi`    |
| Pulumi Python (AI only) | `--from pulumi`    |
| Pulumi Go (AI only)     | `--from pulumi`    |

## Examples

```bash theme={null}
# Convert Terraform
ubx convert --from terraform ./terraform/
ubx convert --from terraform main.tf
ubx convert --from terraform ./tf/ --out ./iac/

# Convert Pulumi TypeScript (mechanical)
ubx convert --from pulumi index.ts

# Convert Pulumi Python (requires AI)
ubx convert --from pulumi __main__.py
```

## Flags

| Flag            | Description                                |
| --------------- | ------------------------------------------ |
| `--from string` | Source format: `terraform` or `pulumi`     |
| `--out string`  | Output directory (default: same directory) |

## Output

Generates:

* `.iac` files for each source file
* `ubx.yaml` project scaffold (if not present)
* `MIGRATION_NOTES.md` for items needing manual review

## Terraform Conversion

See [Migrating from Terraform](/v1/guides/migrating-terraform) for the full mapping table and examples.

## Pulumi TypeScript Conversion

Mechanical conversion for TypeScript. AI-assisted for Python and Go (requires `UBX_AI_API_KEY`):

```bash theme={null}
export UBX_AI_API_KEY=sk-ant-...
ubx convert --from pulumi __main__.py
```
