Skip to main content

network_private_subnets

Creates, updates, deletes, gets or lists a network_private_subnets resource.

Overview​

Namenetwork_private_subnets
TypeResource
Idovh.cloud_network.network_private_subnets

Fields​

The following fields are returned by SELECT queries:

Subnet

NameDatatypeDescription
idstringSubnet id
cidrstring (ip-block)Subnet CIDR (example: 192.0.2.0/24)
dhcp_enabledbooleanIs DHCP enabled for the subnet (wire: dhcpEnabled)
gateway_ipstring (ipv4)Gateway IP in the subnet (example: 192.0.2.0) (wire: gatewayIp)
ip_poolsarrayList of ip pools allocated in subnet (wire: ipPools)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectnetwork_id, service_nameGet network subnets
createinsertnetwork_id, service_name, dhcp, end, network, no_gateway, region, startCreate a new network subnet
deletedeletenetwork_id, subnet_id, service_nameDelete 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.

NameDatatypeDescription
api_hoststringThe 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_idstringNetwork ID (wire: networkId)
service_namestringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
subnet_idstringSubnet ID (wire: subnetId)

SELECT examples​

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 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
;

DELETE examples​

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
;