# 

# exoscale_vpc_subnet (Resource)

Manage Exoscale [VPC](https://community.exoscale.ch/product/networking/vpc/) Subnets.

Corresponding data source: [exoscale\_vpc\_subnet]({{< ref "../data-sources/vpc_subnet.md" >}}).

## Example Usage

```terraform
locals {
  zone = "ch-gva-2"
}

resource "exoscale_vpc_subnet" "my_vpc_subnet" {
  zone        = local.zone
  vpc_id      = "9ecc6b8b-73d4-4211-8ced-f7f29bb79524"
  name        = "my-vpc-subnet"
  description = "My VPC Subnet"
  ipv4_block  = "10.0.0.0/24"

  labels = {
    environment = "production"
  }
}
```

Please refer to the [examples](https://github.com/exoscale/terraform-provider-exoscale/tree/master/examples/)
directory for complete configuration examples.

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `ipv4_block` (String) ❗ The Subnet IPv4 CIDR (e.g. `10.0.0.0/24`).
- `name` (String) The Subnet name.
- `vpc_id` (String) ❗ The parent [exoscale_vpc]({{< ref "./vpc.md" >}}) ID.
- `zone` (String) ❗ The Exoscale [Zone](https://www.exoscale.com/datacenters/) name.

### Optional

- `address_family` (String) ❗ The Subnet address family. Currently only `inet4` is supported.
- `address_space` (String) ❗ The Subnet address space. Currently only `private` is supported.
- `description` (String) A free-form text describing the Subnet.
- `labels` (Map of String) A map of key/value labels.
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-Only

- `id` (String) The ID of this resource.

<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`

Optional:

- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
- `delete` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
- `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

-> The symbol ❗ in an attribute indicates that modifying it, will force the creation of a new resource.

## Import

```shell
# An existing VPC Subnet may be imported by `<vpc-ID>@<subnet-ID>@<zone>`:

terraform import \
  exoscale_vpc_subnet.my_vpc_subnet \
  f81d4fae-7dec-11d0-a765-00a0c91e6bf6@9ecc6b8b-73d4-4211-8ced-f7f29bb79524@ch-gva-2
```

