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

# input

> The input block declares typed, parameterizable values for a stack.

The `input` block declares typed fields that parameterize a stack. At deploy time, values are provided via Pulumi config (`pulumi config set key value`). In the generated Python program, inputs become `pulumi.Config()` calls.

## Syntax

```xcl theme={"theme":"css-variables"}
input "name" {
    field_name: Type
    field_with_default: Type = default_value
}
```

## Example

```xcl theme={"theme":"css-variables"}
input "networking" {
    vpc_cidr:     string       = "10.0.0.0/16"
    azs:          list(string)
    deploy_nat:   bool         = false
}
```

Generated Python:

```python theme={"theme":"css-variables"}
config = pulumi.Config()

vpc_cidr    = config.get("vpc_cidr") or "10.0.0.0/16"
azs         = config.require_object("azs")
deploy_nat  = config.get_bool("deploy_nat") or False
```

## Referencing inputs

Input fields are accessed via the `input.fieldName` qualified form — bare field names are not in scope:

```xcl theme={"theme":"css-variables"}
stack "networking" {
    vpc = aws.ec2.Vpc {
        cidr_block = input.vpc_cidr   // correct
        // cidr_block = vpc_cidr     // error: undefined reference "vpc_cidr"
    }
}
```

When you have multiple input blocks (e.g., one per file), you can disambiguate with `input.blockName.fieldName`:

```xcl theme={"theme":"css-variables"}
// networking-inputs.xcl
input "base" {
    region: string = "us-east-1"
}

// advanced-inputs.xcl
input "advanced" {
    region: string = "eu-west-1"  // would conflict with base.region
}

// In expressions:
provider "aws" {
    region = input.base.region
}
```

## Optional fields (with default)

A field with a default value is optional at deploy time. The default is used when the config key is not set:

```xcl theme={"theme":"css-variables"}
input "s" {
    instance_type: string = "t3.micro"
    count:         int    = 1          // ERROR: "count" is a reserved name
}
```

## Required fields (no default)

A field without a default must be provided via `pulumi config set` before deploying:

```xcl theme={"theme":"css-variables"}
input "s" {
    db_password: string   // required — no default
    db_name:     string
}
```

## Supported types

All XCL types are valid for input fields. See [Types](/v1/xcl/language/types) for the full list.

**Primitive types** map to typed Pulumi config accessors:

* `string` → `config.get()` / `config.require()`
* `bool` → `config.get_bool()` / `config.require_bool()`
* `number` → `config.get_float()` / `config.require_float()`
* `int` → `config.get_int()` / `config.require_int()`
* `any`, `list(T)`, `map(T)`, `object(...)`, `tuple(...)` → `config.require_object()`

## Default value type checking

The typechecker verifies that default values are compatible with the declared type:

```xcl theme={"theme":"css-variables"}
input "s" {
    timeout: number = "30s"  // error: default value is a string literal but field type is number
    enabled: bool   = 1      // error: default value is a number literal but field type is bool
}
```

## Reserved field names

The following names cannot be used as input field names (they are reserved reference namespaces):

`stack`, `input`, `output`, `locals`, `module`, `provider`, `import`, `space`, `root`, `for`, `when`, `match`, `default`, `count`, `each`

**Error:** `"count" is a reserved reference namespace - choose a different name`

## Multiple input blocks

A stack may have multiple `input` blocks (typically one per `.xcl` file). All fields across all input blocks share a flat namespace — duplicate field names across blocks are an error:

```xcl theme={"theme":"css-variables"}
// Error:
// file-a.xcl
input "a" { region: string }
// file-b.xcl
input "b" { region: string }  // "region" is already defined in file-a.xcl:2 - remove one, or rename
```
