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

# Resources

> How cloud resources are modelled in ubx.

In ubx, every cloud resource is declared with a `unit` block. Each `unit` maps 1:1 to a Pulumi provider resource.

## Resource Addresses

Resources are addressed using dot notation:

```
unit.resource_type.name
```

Examples:

* `unit.aws_s3_bucket_v2.assets`
* `unit.aws_rds_instance.db`
* `unit.google_storage_bucket.media`

## Resource Outputs

Every cloud resource has output attributes — values known only after the resource is created. Access them with the `~` prefix:

```hcl theme={null}
~unit.aws_rds_instance.db.endpoint   # Pending<string>
~unit.aws_s3_bucket_v2.assets.arn    # Pending<string>
~unit.aws_eks_cluster.cluster.name   # Pending<string>
```

## Providers and Resource Types

ubx uses the same resource type names as Terraform/Pulumi, in snake\_case:

| Provider   | Example type                                            |
| ---------- | ------------------------------------------------------- |
| AWS        | `aws_rds_instance`, `aws_s3_bucket_v2`, `aws_vpc`       |
| GCP        | `google_storage_bucket`, `google_sql_database_instance` |
| Azure      | `azurerm_resource_group`, `azurerm_storage_account`     |
| Kubernetes | Used via `deploy` and `sync` blocks                     |

Run `ubx schema list` to see all registered types. Run `ubx docs <type> --list` to see fields.

## Viewing Resource Schema

```bash theme={null}
ubx docs aws_rds_instance --list
# Required:
#   engine               string
#   instance_class       string
#   ...
# Optional:
#   allocated_storage    number
#   multi_az             bool
#   ...
```

## Resource Lifecycle

Resources go through these states:

1. **Planned** — `ubx plan` shows what will happen
2. **Created** — `ubx apply` provisions the resource
3. **Updated** — `ubx apply` after attribute changes
4. **Refreshed** — `ubx refresh` syncs state with actual cloud
5. **Destroyed** — `ubx destroy` removes the resource
