Create, read, and update a Linode VPC Subnet.
| Field | Type | Required | Description |
|---|---|---|---|
api_token |
str |
Required | The Linode account personal access token. It is necessary to run the module. It can be exposed by the environment variable LINODE_API_TOKEN instead. See details in Usage. |
- name: Create a VPC subnet
linode.cloud.vpc_subnet:
vpc_id: 12345
label: my-subnet
ipv4: '10.0.0.0/24'
state: present# NOTE: IPv6 VPCs may not currently be available to all users.
- name: Create a VPC subnet with an auto-allocated IPv6 range
linode.cloud.vpc_subnet:
vpc_id: 12345
label: my-subnet
ipv6:
- range: auto
state: present- name: Delete a VPC Subnet
linode.cloud.vpc_subnet:
vpc_id: 12345
label: my-subnet
state: absent| Field | Type | Required | Description |
|---|---|---|---|
vpc_id |
int |
Required | The ID of the parent VPC for this subnet. |
label |
str |
Required | This VPC's unique label. |
state |
str |
Required | The state of this token. (Choices: present, absent) |
ipv4 |
str |
Optional | The IPV4 range for this subnet in CIDR format. |
ipv6 (sub-options) |
list |
Optional | The IPv6 ranges of this subnet. NOTE: IPv6 VPCs may not currently be available to all users. |
| Field | Type | Required | Description |
|---|---|---|---|
range |
str |
Optional | An existing IPv6 prefix owned by the current account or a forward slash (/) followed by a valid prefix length. If unspecified, a range with the default prefix will be allocated for this VPC. |
-
subnet- The VPC in JSON serialized form.- Sample Response:
{ "created": "2023-08-31T18:53:04", "id": 271, "ipv4": "10.0.0.0/24", "ipv6": [ { "range": "2001:db8:acad:300::/56" } ], "label": "test-subnet", "linodes": [ { "id": 1234567, "interfaces": [ { "active": true, "config_id": 123456, "id": 123456 } ] } ], "databases": [ { "id": 1234567, "ipv4_range": "10.0.0.16/28", "ipv6_range": "2001:db8:1234:1::/64" } ], "updated": "2023-08-31T18:53:04" } - See the Linode API response documentation for a list of returned fields
- Sample Response: