---
title: "exoscale_vpc_subnet (Data Source)"
description: "Fetch Exoscale VPC https://community.exoscale.com/product/networking/vpc/ Subnet data.\nCorresponding resource: exoscalevpcsubnet ../resources/vpc_subnet.md."
url: https://community.exoscale.com/reference/terraform/provider/data-sources/vpc_subnet/
section: reference
last_updated: 2026-10-29
---
> For AI agents: the documentation index is at https://community.exoscale.com/llms.txt. Every page is available as markdown at `<page URL>index.md` or with `Accept: text/markdown`.

# exoscale_vpc_subnet (Data Source)

Fetch Exoscale [VPC](https://community.exoscale.com/product/networking/vpc/index.md) Subnet data.

Corresponding resource: [exoscale_vpc_subnet](https://community.exoscale.com/reference/terraform/provider/resources/vpc_subnet/index.md).

## Example Usage

```terraform
data "exoscale_vpc_subnet" "my_vpc_subnet" {
  zone   = "ch-gva-2"
  vpc_id = "9ecc6b8b-73d4-4211-8ced-f7f29bb79524"
  name   = "my-vpc-subnet"
}

output "my_vpc_subnet_id" {
  value = data.exoscale_vpc_subnet.my_vpc_subnet.id
}
```

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


## Schema

### Required

- `vpc_id` (String) The parent [exoscale_vpc](https://community.exoscale.com/reference/terraform/provider/data-sources/vpc/index.md) ID.
- `zone` (String) The Exoscale [Zone](https://www.exoscale.com/datacenters/) name.

### Optional

- `id` (String) The Subnet ID to match (conflicts with `name`).
- `name` (String) The Subnet name to match (conflicts with `id`).
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-Only

- `address_family` (String) The Subnet address family.
- `address_space` (String) The Subnet address space.
- `description` (String) The Subnet description.
- `ipv4_block` (String) The Subnet IPv4 CIDR.
- `labels` (Map of String) A map of key/value labels.

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

Optional:

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

