> ## 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 plan

> Preview infrastructure changes without deploying.

`ubx plan` compiles `.iac` files and runs `pulumi preview` to show what changes will be made — without deploying.

## Usage

```bash theme={null}
ubx plan [path] [flags]
```

## Examples

```bash theme={null}
ubx plan
ubx plan ./stacks/networking
ubx plan --env prod
ubx plan --target unit.aws_rds_instance.db
ubx plan --target unit.aws_rds_instance.db --target unit.aws_s3_bucket_v2.assets
```

## Flags

| Flag                   | Description                             |
| ---------------------- | --------------------------------------- |
| `--env string`         | Target environment                      |
| `--stack string`       | Target stack name                       |
| `--target stringArray` | Target a specific resource (repeatable) |
| `--no-color`           | Disable color output                    |

## Output

```
  ◆ Compile    stack.iac → .ubx/index.ts
  ◆ Stack      dev
  ◆ Packages   ready

  ─── Preview ────────────────────────

  +  aws:rds:Instance         db           (new)
  +  aws:s3:BucketV2          assets       (new)
  ~  aws:s3:BucketV2          logs         (update)

  2 to create · 1 to update · 0 to destroy
```

## Resource Symbols

| Symbol | Meaning                   |
| ------ | ------------------------- |
| `+`    | Create                    |
| `~`    | Update                    |
| `-`    | Delete                    |
| `±`    | Replace (delete + create) |

## AI Summary and Cost Estimate

When AI is enabled, `ubx plan` appends:

```
  ─── AI Summary ─────────────────────

  This plan creates a PostgreSQL database and an S3 storage bucket.

  Risk: medium — new database with hardcoded credentials
  Next: verify db_password is set before applying

  ─── Cost Estimate ──────────────────

  ✓  Estimated monthly cost: ~$13.50  (high confidence)
  RDS PostgreSQL db.t3.micro    $13.50   on-demand, us-east-1
  S3 bucket (assets)            $ 0.00   minimal usage assumed
```

Configure in `ubx.yaml`:

```yaml theme={null}
ai:
  enabled: true
  api_key: "sk-ant-..."
  features:
    plan_summary: true
    cost_estimate: true
```

## `--target` Flag

Supported address formats:

```bash theme={null}
--target unit.resource_type.name
--target component.name
--target deploy.helm.name
--target sync.argocd.name
```

`input`, `output`, `local`, and other non-resource block types are not supported.
