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

> Compile and deploy your infrastructure.

`ubx apply` compiles `.iac` files to Pulumi TypeScript and runs `pulumi up`.

## Usage

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

## Examples

```bash theme={null}
ubx apply
ubx apply ./stacks/networking
ubx apply --env prod
ubx apply --yes
ubx apply --dry-run
ubx apply --target unit.aws_s3_bucket_v2.assets
```

## Flags

| Flag                   | Description                                              |
| ---------------------- | -------------------------------------------------------- |
| `--dry-run`            | Compile and write `index.ts` without running `pulumi up` |
| `--yes`                | Skip plan preview and confirmation prompt                |
| `--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

  ─── Applying ───────────────────────

  +  aws:rds:Instance    db        12s
  +  aws:s3:BucketV2     assets     2s

  ✓  done in 15s · 2 created · 0 changed · 0 destroyed

  ─── Outputs ────────────────────────

  db_endpoint  =  "db.xxxx.eu-west-1.rds.amazonaws.com"
  bucket_name  =  "dev-my-assets"
```

## Confirmation Prompt

When the plan contains **deletions or replacements**:

```
⚠  This plan will delete 1 resource and replace 2 resources.
Continue? [y/N]
```

* Default is **N** — type `y` or `yes` to proceed
* `--yes` skips the prompt
* Pure creates proceed without a prompt

## Dry Run

Compiles and writes `.ubx/index.ts` without deploying:

```bash theme={null}
ubx apply --dry-run
cat .ubx/index.ts
```

## Generated Files

```
.ubx/
  index.ts       # generated Pulumi TypeScript
  Pulumi.yaml    # Pulumi project config
  package.json   # npm dependencies
  node_modules/  # installed packages
  state/         # local state
```

Add `.ubx/` to your `.gitignore`.

## CI/CD

```bash theme={null}
ubx apply --yes --env prod
```
