Skip to main content

virtual_networks

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

Overview

Namevirtual_networks
TypeResource
Idcloudflare.zero_trust.virtual_networks

Fields

The following fields are returned by SELECT queries:

A virtual network response

NameDatatypeDescription
idstring (uuid)UUID of the virtual network. (example: f70ff985-a4ef-4643-bbbc-4a0ed4fc8415)
namestringA user-friendly name for the virtual network. (example: us-east-1-vpc)
commentstringOptional remark describing the virtual network. (default: , example: Staging VPC for data science)
created_atstring (date-time)Timestamp of when the resource was created. (example: 2021-01-25T18:22:34.317854Z)
deleted_atstring (date-time)Timestamp of when the resource was deleted. If null, the resource has not been deleted. (example: 2009-11-10T23:00:00.000000Z)
is_default_networkbooleanIf true, this virtual network is the default for the account. (x-stainless-terraform-configurability: computed_optional)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, virtual_network_idGet a virtual network.
listselectaccount_idid, name, is_default, is_default_network, is_deletedLists and filters virtual networks in an account.
createinsertaccount_id, nameAdds a new virtual network to an account.
editupdateaccount_id, virtual_network_idUpdates an existing virtual network.
deletedeletevirtual_network_id, account_idDeletes an existing virtual network.

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
account_idstringThe Cloudflare account ID.
virtual_network_idstring (uuid)
idstring (uuid)
is_defaultboolean
is_default_networkboolean
is_deletedboolean
namestring

SELECT examples

Get a virtual network.

SELECT
id,
name,
comment,
created_at,
deleted_at,
is_default_network
FROM cloudflare.zero_trust.virtual_networks
WHERE account_id = '{{ account_id }}' -- required
AND virtual_network_id = '{{ virtual_network_id }}' -- required
;

INSERT examples

Adds a new virtual network to an account.

INSERT INTO cloudflare.zero_trust.virtual_networks (
comment,
is_default,
is_default_network,
name,
account_id
)
SELECT
'{{ comment }}',
{{ is_default }},
{{ is_default_network }},
'{{ name }}' /* required */,
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples

Updates an existing virtual network.

UPDATE cloudflare.zero_trust.virtual_networks
SET
comment = '{{ comment }}',
is_default_network = {{ is_default_network }},
name = '{{ name }}'
WHERE
account_id = '{{ account_id }}' --required
AND virtual_network_id = '{{ virtual_network_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Deletes an existing virtual network.

DELETE FROM cloudflare.zero_trust.virtual_networks
WHERE virtual_network_id = '{{ virtual_network_id }}' --required
AND account_id = '{{ account_id }}' --required
;