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

# provider block

> Pin provider versions in the generated package.json.

The `provider` block pins exact provider npm package versions in the generated `package.json`, enabling reproducible deploys.

## Syntax

```hcl theme={null}
provider "name" {
  version = "~> 6.0"
}
```

Only `version` is supported in v1.

## Example

```hcl theme={null}
provider "aws" {
  version = "~> 6.0"
}

provider "kubernetes" {
  version = "= 4.2.0"
}
```

## Version Constraint Translation

| ubx syntax | npm equivalent | Meaning             |
| ---------- | -------------- | ------------------- |
| `~> 6.0`   | `^6.0.0`       | Compatible with 6.x |
| `= 4.2.0`  | `4.2.0`        | Exact pin           |
| `>= 5.0.0` | `>=5.0.0`      | Minimum version     |

## Supported Providers

| ubx name     | npm package            |
| ------------ | ---------------------- |
| `aws`        | `@pulumi/aws`          |
| `gcp`        | `@pulumi/gcp`          |
| `azure`      | `@pulumi/azure-native` |
| `kubernetes` | `@pulumi/kubernetes`   |
| `random`     | `@pulumi/random`       |
| `tls`        | `@pulumi/tls`          |

Unknown provider names produce a warning (not an error) — future providers are allowed.

## No TypeScript Emitted

Provider blocks only affect `package.json` — no TypeScript is emitted for them.

## Error Cases

```hcl theme={null}
# Duplicate provider — compile error
provider "aws" { version = "~> 6.0" }
provider "aws" { version = "~> 5.0" }
# ✗  a provider block for "aws" is already declared

# Unknown attribute — compile error
provider "aws" { version = "~> 6.0"; region = "eu-west-1" }
# ✗  provider blocks only support the "version" attribute in v1
```
