network_private_subnets
Creates, updates, deletes, gets or lists a network_private_subnets resource.
Overview​
| Name | network_private_subnets |
| Type | Resource |
| Id | ovh.cloud_network.network_private_subnets |
Fields​
The following fields are returned by SELECT queries:
- list
Subnet
| Name | Datatype | Description |
|---|---|---|
id | string | Subnet id |
cidr | string (ip-block) | Subnet CIDR (example: 192.0.2.0/24) |
dhcp_enabled | boolean | Is DHCP enabled for the subnet (wire: dhcpEnabled) |
gateway_ip | string (ipv4) | Gateway IP in the subnet (example: 192.0.2.0) (wire: gatewayIp) |
ip_pools | array | List of ip pools allocated in subnet (wire: ipPools) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | network_id, service_name | Get network subnets | |
create | insert | network_id, service_name, dhcp, end, network, no_gateway, region, start | Create a new network subnet | |
delete | delete | network_id, subnet_id, service_name | Delete a network subnet |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
api_host | string | The OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}}) |
network_id | string | Network ID (wire: networkId) |
service_name | string | The Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set. |
subnet_id | string | Subnet ID (wire: subnetId) |
SELECT examples​
- list
Get network subnets
SELECT
id,
cidr,
dhcp_enabled,
gateway_ip,
ip_pools
FROM ovh.cloud_network.network_private_subnets
WHERE network_id = '{{ network_id }}' -- required
AND service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;
INSERT examples​
- create
- Manifest
Create a new network subnet
INSERT INTO ovh.cloud_network.network_private_subnets (
dhcp,
end,
network,
no_gateway,
region,
start,
network_id,
service_name
)
SELECT
{{ dhcp }} /* required */,
'{{ end }}' /* required */,
'{{ network }}' /* required */,
{{ no_gateway }} /* required */,
'{{ region }}' /* required */,
'{{ start }}' /* required */,
'{{ network_id }}',
'{{ service_name }}'
RETURNING
id,
cidr,
dhcp_enabled,
gateway_ip,
ip_pools
;
# Description fields are for documentation purposes
- name: network_private_subnets
props:
- name: network_id
value: "{{ network_id }}"
description: Required parameter for the network_private_subnets resource.
- name: service_name
value: "{{ service_name }}"
description: Required parameter for the network_private_subnets resource.
- name: dhcp
value: {{ dhcp }}
description: |
Enable DHCP
- name: end
value: "{{ end }}"
description: |
Last IP for this region (eg: 192.168.1.24)
- name: network
value: "{{ network }}"
description: |
Global network with cidr (eg: 192.168.1.0/24)
- name: no_gateway
value: {{ no_gateway }}
description: |
Set to true if you don't want to set a default gateway IP
- name: region
value: "{{ region }}"
description: |
Region where this subnet will be created
- name: start
value: "{{ start }}"
description: |
First IP for this region (eg: 192.168.1.12)
DELETE examples​
- delete
Delete a network subnet
DELETE FROM ovh.cloud_network.network_private_subnets
WHERE network_id = '{{ network_id }}' --required
AND subnet_id = '{{ subnet_id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;