gre_tunnels
Creates, updates, deletes, gets or lists a gre_tunnels resource.
Overview
| Name | gre_tunnels |
| Type | Resource |
| Id | cloudflare.magic_transit.gre_tunnels |
Fields
The following fields are returned by SELECT queries:
- get
- list
List GRE Tunnel Details response
| Name | Datatype | Description |
|---|---|---|
gre_tunnel | object |
List GRE tunnels response
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier (example: c4a7362d577a6c3019a474fd6f485821) |
name | string | The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel. (example: GRE_1) |
automatic_return_routing | boolean | True if automatic stateful return routing should be enabled for a tunnel, false otherwise. Requires the coupler_integration account flag to be enabled; requests setting this to true without that flag will be rejected. |
bgp | object | |
bgp_status | object | |
cloudflare_gre_endpoint | string | The IP address assigned to the Cloudflare side of the GRE tunnel. (example: 203.0.113.1) |
created_on | string (date-time) | The date and time the tunnel was created. (example: 2017-06-14T00:00:00Z) |
customer_gre_endpoint | string | The IP address assigned to the customer side of the GRE tunnel. (example: 203.0.113.1) |
description | string | An optional description of the GRE tunnel. (example: Tunnel for ISP X) |
health_check | object | |
interface_address | string | A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. (example: 192.0.2.0/31) |
interface_address6 | string | A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 (example: 2606:54c1:7:0:a9fe:12d2:1:200/127) |
modified_on | string (date-time) | The date and time the tunnel was last modified. (example: 2017-06-14T05:20:00Z) |
mtu | integer | Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576. |
ttl | integer | Time To Live (TTL) in number of hops of the GRE tunnel. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | gre_tunnel_id, account_id | x-magic-new-hc-target | Lists informtion for a specific GRE tunnel. |
list | select | account_id | x-magic-new-hc-target | Lists GRE tunnels associated with an account. |
create | insert | account_id, name, customer_gre_endpoint, cloudflare_gre_endpoint, interface_address | x-magic-new-hc-target | Creates a new GRE tunnel. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes. |
update | replace | gre_tunnel_id, account_id, name, customer_gre_endpoint, cloudflare_gre_endpoint, interface_address | x-magic-new-hc-target | Updates a specific GRE tunnel. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes. |
bulk_update | replace | account_id | x-magic-new-hc-target | Updates multiple GRE tunnels. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes. |
delete | delete | gre_tunnel_id, account_id | x-magic-new-hc-target | Disables and removes a specific static GRE tunnel. 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.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
gre_tunnel_id | string | |
x-magic-new-hc-target | boolean | If true, the health check target in the response body will be presented using the new object format. Defaults to false. |
SELECT examples
- get
- list
Lists informtion for a specific GRE tunnel.
SELECT
gre_tunnel
FROM cloudflare.magic_transit.gre_tunnels
WHERE gre_tunnel_id = '{{ gre_tunnel_id }}' -- required
AND account_id = '{{ account_id }}' -- required
AND x-magic-new-hc-target = '{{ x-magic-new-hc-target }}'
;
Lists GRE tunnels associated with an account.
SELECT
id,
name,
automatic_return_routing,
bgp,
bgp_status,
cloudflare_gre_endpoint,
created_on,
customer_gre_endpoint,
description,
health_check,
interface_address,
interface_address6,
modified_on,
mtu,
ttl
FROM cloudflare.magic_transit.gre_tunnels
WHERE account_id = '{{ account_id }}' -- required
AND x-magic-new-hc-target = '{{ x-magic-new-hc-target }}'
;
INSERT examples
- create
- Manifest
Creates a new GRE tunnel. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes.
INSERT INTO cloudflare.magic_transit.gre_tunnels (
automatic_return_routing,
bgp,
cloudflare_gre_endpoint,
customer_gre_endpoint,
description,
health_check,
interface_address,
interface_address6,
mtu,
name,
ttl,
account_id,
x-magic-new-hc-target
)
SELECT
{{ automatic_return_routing }},
'{{ bgp }}',
'{{ cloudflare_gre_endpoint }}' /* required */,
'{{ customer_gre_endpoint }}' /* required */,
'{{ description }}',
'{{ health_check }}',
'{{ interface_address }}' /* required */,
'{{ interface_address6 }}',
{{ mtu }},
'{{ name }}' /* required */,
{{ ttl }},
'{{ account_id }}',
'{{ x-magic-new-hc-target }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: gre_tunnels
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the gre_tunnels resource.
- name: automatic_return_routing
value: {{ automatic_return_routing }}
description: |
True if automatic stateful return routing should be enabled for a tunnel, false otherwise. Requires the `coupler_integration` account flag to be enabled; requests setting this to `true` without that flag will be rejected.
default: false
- name: bgp
value:
customer_asn: {{ customer_asn }}
extra_prefixes:
- "{{ extra_prefixes }}"
md5_key: "{{ md5_key }}"
- name: cloudflare_gre_endpoint
value: "{{ cloudflare_gre_endpoint }}"
description: |
The IP address assigned to the Cloudflare side of the GRE tunnel.
- name: customer_gre_endpoint
value: "{{ customer_gre_endpoint }}"
description: |
The IP address assigned to the customer side of the GRE tunnel.
- name: description
value: "{{ description }}"
description: |
An optional description of the GRE tunnel.
- name: health_check
value:
enabled: {{ enabled }}
rate: "{{ rate }}"
target:
effective: "{{ effective }}"
saved: "{{ saved }}"
type: "{{ type }}"
direction: "{{ direction }}"
- name: interface_address
value: "{{ interface_address }}"
description: |
A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.
- name: interface_address6
value: "{{ interface_address6 }}"
description: |
A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127
- name: mtu
value: {{ mtu }}
description: |
Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576.
default: 1476
- name: name
value: "{{ name }}"
description: |
The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel.
- name: ttl
value: {{ ttl }}
description: |
Time To Live (TTL) in number of hops of the GRE tunnel.
default: 64
- name: x-magic-new-hc-target
value: {{ x-magic-new-hc-target }}
description: If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.
description: If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.
REPLACE examples
- update
- bulk_update
Updates a specific GRE tunnel. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes.
REPLACE cloudflare.magic_transit.gre_tunnels
SET
automatic_return_routing = {{ automatic_return_routing }},
cloudflare_gre_endpoint = '{{ cloudflare_gre_endpoint }}',
customer_gre_endpoint = '{{ customer_gre_endpoint }}',
description = '{{ description }}',
health_check = '{{ health_check }}',
interface_address = '{{ interface_address }}',
interface_address6 = '{{ interface_address6 }}',
mtu = {{ mtu }},
name = '{{ name }}',
ttl = {{ ttl }}
WHERE
gre_tunnel_id = '{{ gre_tunnel_id }}' --required
AND account_id = '{{ account_id }}' --required
AND name = '{{ name }}' --required
AND customer_gre_endpoint = '{{ customer_gre_endpoint }}' --required
AND cloudflare_gre_endpoint = '{{ cloudflare_gre_endpoint }}' --required
AND interface_address = '{{ interface_address }}' --required
AND x-magic-new-hc-target = {{ x-magic-new-hc-target}}
RETURNING
errors,
messages,
result,
success;
Updates multiple GRE tunnels. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes.
REPLACE cloudflare.magic_transit.gre_tunnels
SET
-- No updatable properties
WHERE
account_id = '{{ account_id }}' --required
AND x-magic-new-hc-target = {{ x-magic-new-hc-target}}
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
Disables and removes a specific static GRE tunnel. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes.
DELETE FROM cloudflare.magic_transit.gre_tunnels
WHERE gre_tunnel_id = '{{ gre_tunnel_id }}' --required
AND account_id = '{{ account_id }}' --required
AND x-magic-new-hc-target = '{{ x-magic-new-hc-target }}'
;