Skip to main content

ipsec_tunnels

Creates, updates, deletes, gets or lists an ipsec_tunnels resource.

Overview

Nameipsec_tunnels
TypeResource
Idcloudflare.magic_transit.ipsec_tunnels

Fields

The following fields are returned by SELECT queries:

List IPsec tunnel details response

NameDatatypeDescription
ipsec_tunnelobject

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectipsec_tunnel_id, account_idx-magic-new-hc-targetLists details for a specific IPsec tunnel.
listselectaccount_idx-magic-new-hc-targetLists IPsec tunnels associated with an account.
psk_generateinsertipsec_tunnel_id, account_idGenerates a Pre Shared Key for a specific IPsec tunnel used in the IKE session. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes. After a PSK is generated, the PSK is immediately persisted to Cloudflare's edge and cannot be retrieved later. Note the PSK in a safe place.
createinsertaccount_id, name, cloudflare_endpoint, interface_addressx-magic-new-hc-targetCreates a new IPsec tunnel associated with an account. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes.
updatereplaceipsec_tunnel_id, account_id, name, cloudflare_endpoint, interface_addressx-magic-new-hc-targetUpdates a specific IPsec tunnel associated with an account. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes.
bulk_updatereplaceaccount_idx-magic-new-hc-targetUpdate multiple IPsec tunnels associated with an account. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes.
deletedeleteipsec_tunnel_id, account_idx-magic-new-hc-targetDisables and removes a specific static IPsec Tunnel associated with an account. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes.

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.
ipsec_tunnel_idstring
x-magic-new-hc-targetbooleanIf true, the health check target in the response body will be presented using the new object format. Defaults to false.

SELECT examples

Lists details for a specific IPsec tunnel.

SELECT
ipsec_tunnel
FROM cloudflare.magic_transit.ipsec_tunnels
WHERE ipsec_tunnel_id = '{{ ipsec_tunnel_id }}' -- required
AND account_id = '{{ account_id }}' -- required
AND x-magic-new-hc-target = '{{ x-magic-new-hc-target }}'
;

INSERT examples

Generates a Pre Shared Key for a specific IPsec tunnel used in the IKE session. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes. After a PSK is generated, the PSK is immediately persisted to Cloudflare's edge and cannot be retrieved later. Note the PSK in a safe place.

INSERT INTO cloudflare.magic_transit.ipsec_tunnels (
ipsec_tunnel_id,
account_id
)
SELECT
'{{ ipsec_tunnel_id }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples

Updates a specific IPsec tunnel associated with an account. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes.

REPLACE cloudflare.magic_transit.ipsec_tunnels
SET
automatic_return_routing = {{ automatic_return_routing }},
bgp = '{{ bgp }}',
cloudflare_endpoint = '{{ cloudflare_endpoint }}',
custom_remote_identities = '{{ custom_remote_identities }}',
customer_endpoint = '{{ customer_endpoint }}',
description = '{{ description }}',
health_check = '{{ health_check }}',
interface_address = '{{ interface_address }}',
interface_address6 = '{{ interface_address6 }}',
name = '{{ name }}',
psk = '{{ psk }}',
replay_protection = {{ replay_protection }}
WHERE
ipsec_tunnel_id = '{{ ipsec_tunnel_id }}' --required
AND account_id = '{{ account_id }}' --required
AND name = '{{ name }}' --required
AND cloudflare_endpoint = '{{ cloudflare_endpoint }}' --required
AND interface_address = '{{ interface_address }}' --required
AND x-magic-new-hc-target = {{ x-magic-new-hc-target}}
RETURNING
errors,
messages,
result,
success;

DELETE examples

Disables and removes a specific static IPsec Tunnel associated with an account. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes.

DELETE FROM cloudflare.magic_transit.ipsec_tunnels
WHERE ipsec_tunnel_id = '{{ ipsec_tunnel_id }}' --required
AND account_id = '{{ account_id }}' --required
AND x-magic-new-hc-target = '{{ x-magic-new-hc-target }}'
;