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

# Language Overview

> ubx syntax, block types, the ~ sigil, and the Pending type system.

## File Extension

ubx source files use the `.iac` extension.

## Syntax

```hcl theme={null}
# This is a comment
// This is also a comment

block_keyword "type" "name" {
  attribute_key = value
  nested_object = {
    key = value
  }
  list_value = ["a", "b", "c"]
}
```

## Value Types

| Type          | Example                 | Notes                  |
| ------------- | ----------------------- | ---------------------- |
| String        | `"eu-west-1"`           | Double-quoted          |
| Number        | `42`, `3.14`            | Integer or float       |
| Boolean       | `true`, `false`         |                        |
| Object        | `{ key = value }`       | Nested key-value pairs |
| List          | `["a", "b"]`            | Ordered list           |
| Pending ref   | `~unit.x.y.z`           | Async cloud output     |
| Resolved ref  | `input.name`            | Compile-time variable  |
| Interpolation | `"${input.env}-bucket"` | Embedded expressions   |

## Attribute Naming

Attribute keys use `snake_case` in `.iac` files, automatically converted to `camelCase` in generated TypeScript:

```hcl theme={null}
instance_class = "db.t3.micro"   # .iac
# → instanceClass: "db.t3.micro"  # TypeScript
```

## The `~` Sigil and `Pending&lt;T&gt;`

The `~` prefix marks values that resolve at apply time:

```hcl theme={null}
# Resolved<string> — known at compile time
engine = "postgres"

# Pending<string> — known only after apply
host = ~unit.aws_rds_instance.db.endpoint
```

`Pending&lt;T&gt;` propagates. If a value depends on a `Pending&lt;T&gt;`, it is also `Pending&lt;T&gt;`. The code generator converts `Pending&lt;T&gt;` references into Pulumi `Output&lt;T&gt;.apply()` chains automatically.

See [The `Pending&lt;T&gt;` Type System](/v1/concepts/pending-type) for a full deep dive.

## Block Types

### Resource Blocks — create cloud resources

| Block                                 | Purpose                     | Labels          |
| ------------------------------------- | --------------------------- | --------------- |
| [`unit`](/v1/language/unit)           | Single cloud resource       | `"type" "name"` |
| [`component`](/v1/language/component) | Reusable component          | `"name"`        |
| [`deploy`](/v1/language/deploy)       | Helm/Kustomize deployment   | `"type" "name"` |
| [`sync`](/v1/language/sync)           | GitOps target (ArgoCD/Flux) | `"type" "name"` |

### Value Blocks — define values

| Block                           | Purpose                 | Labels          |
| ------------------------------- | ----------------------- | --------------- |
| [`input`](/v1/language/input)   | Stack variable          | `"name"`        |
| [`output`](/v1/language/output) | Stack output            | `"name"`        |
| [`local`](/v1/language/local)   | Reusable computed value | `"name"`        |
| [`data`](/v1/language/data)     | Read-only cloud lookup  | `"type" "name"` |

### Modifier Blocks

| Block                               | Purpose                        | Labels          |
| ----------------------------------- | ------------------------------ | --------------- |
| [`extend`](/v1/language/extend)     | Environment-specific overrides | varies          |
| [`import`](/v1/language/import)     | Import existing resource       | `"type" "name"` |
| [`moved`](/v1/language/moved)       | Rename resource in state       | none            |
| [`provider`](/v1/language/provider) | Pin provider version           | `"name"`        |

### Governance Blocks

| Block                                 | Purpose                  | Labels   |
| ------------------------------------- | ------------------------ | -------- |
| [`policy`](/v1/language/policy)       | Compile-time compliance  | `"name"` |
| [`remote`](/v1/language/remote)       | Cross-stack reference    | `"name"` |
| [`interface`](/v1/language/interface) | Stack output contracts   | `"name"` |
| [`workspace`](/v1/language/workspace) | Multi-repo orchestration | `"name"` |

## String Interpolation

```hcl theme={null}
input "env" { default = "staging" }

unit "aws_s3_bucket_v2" "logs" {
  bucket = "${input.env}-app-logs"    # → "staging-app-logs"
}
```

With `Pending&lt;T&gt;`:

```hcl theme={null}
unit "aws_s3_bucket_v2" "replica" {
  bucket = "${~unit.aws_s3_bucket_v2.primary.bucket}-replica"
  # → primary.bucket.apply(b => `${b}-replica`)
}
```

## Meta-Arguments

These work on `unit`, `component`, `deploy`, and `sync` blocks:

| Argument             | Description                                                  |
| -------------------- | ------------------------------------------------------------ |
| `count = N`          | Create N copies; use `count.index` (0-based)                 |
| `for_each = map`     | Iterate over map; use `each.key` / `each.value`              |
| `when = condition`   | Conditionally create the resource                            |
| `depends_on = [...]` | Explicit dependency ordering                                 |
| `lifecycle { ... }`  | `prevent_destroy`, `ignore_changes`, `create_before_destroy` |
| `cost_limit = N`     | Monthly cost ceiling in USD (requires AI)                    |
