Skip to content

Commit

Permalink
cloudflare_ipsec_tunnel: swap to autogenerated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz committed Jun 8, 2022
1 parent 1d66657 commit 7eb814f
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 106 deletions.
75 changes: 42 additions & 33 deletions docs/resources/cloudflare_ipsec_tunnel.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,63 @@
---
layout: "cloudflare"
page_title: "Cloudflare: cloudflare_ipsec_tunnel"
description: Provides a resource which manages IPsec tunnels for Magic Transit.
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cloudflare_ipsec_tunnel Resource - Cloudflare"
subcategory: ""
description: |-
Provides a resource, that manages IPsec tunnels for Magic Transit.
---

# cloudflare_ipsec_tunnel
# cloudflare_ipsec_tunnel (Resource)

Provides a resource, that manages IPsec tunnels for Magic Transit.

## Example Usage

```hcl
```terraform
resource "cloudflare_ipsec_tunnel" "example" {
account_id = "c4a7362d577a6c3019a474fd6f485821"
name = "IPsec_1"
customer_endpoint = "203.0.113.1"
cloudflare_endpoint = "203.0.113.1"
interface_address = "192.0.2.0/31"
description = "Tunnel for ISP X"
health_check_enabled = true
health_check_target = "203.0.113.1"
health_check_type = "reply"
psk = "asdf12341234"
account_id = "c4a7362d577a6c3019a474fd6f485821"
name = "IPsec_1"
customer_endpoint = "203.0.113.1"
cloudflare_endpoint = "203.0.113.1"
interface_address = "192.0.2.0/31"
description = "Tunnel for ISP X"
health_check_enabled = true
health_check_target = "203.0.113.1"
health_check_type = "reply"
psk = "asdf12341234"
}
```

## Argument Reference
<!-- schema generated by tfplugindocs -->
## Schema

The following arguments are supported:
### Required

* `account_id` - (Required) The ID of the account where the tunnel is being created.
* `name` - (Required) Name of the IPsec tunnel.
* `customer_endpoint` - (Required) IP address assigned to the customer side of the IPsec tunnel.
* `cloudflare_endpoint` - (Required) IP address assigned to the Cloudflare side of the IPsec tunnel.
* `interface_address` - (Required) 31-bit prefix (/31 in CIDR notation) supporting 2 hosts, one for each side of the tunnel.
* `description` - (Optional) An optional description of the IPsec tunnel.
* `health_check_enabled` - (Optional) Specifies if ICMP tunnel health checks are enabled Default: `true`.
* `health_check_target` - (Optional) The IP address of the customer endpoint that will receive tunnel health checks. Default: `<customer_gre_endpoint>`.
* `health_check_type` - (Optional) Specifies the ICMP echo type for the health check (`request` or `reply`) Default: `reply`.
* `psk` - (Optional) Pre shared key to be used with the IPsec tunnel. If left unset, it will be autogenerated.
* `remote_id` - (Optional) ID to be used while setting up the IPsec tunnel. This value is generated by cloudflare.
* `hex_id` - (Optional) `remote_id` as a hex string. This value is generated by cloudflare.
* `user_id` - (Optional) `remote_id` in the form of an email address. This value is generated by cloudflare.
* `fqdn_id` - (Optional) `remote_id` in the form of a fqdn. This value is generated by cloudflare.
- `cloudflare_endpoint` (String) IP address assigned to the Cloudflare side of the IPsec tunnel.
- `customer_endpoint` (String) IP address assigned to the customer side of the IPsec tunnel.
- `interface_address` (String) 31-bit prefix (/31 in CIDR notation) supporting 2 hosts, one for each side of the tunnel.
- `name` (String) Name of the IPsec tunnel.

### Optional

- `account_id` (String) The account identifier to target for the resource.
- `description` (String) An optional description of the IPsec tunnel.
- `fqdn_id` (String) `remote_id` in the form of a fqdn. This value is generated by cloudflare.
- `health_check_enabled` (Boolean) Specifies if ICMP tunnel health checks are enabled. Default: `true`.
- `health_check_target` (String) The IP address of the customer endpoint that will receive tunnel health checks. Default: `<customer_gre_endpoint>`.
- `health_check_type` (String) Specifies the ICMP echo type for the health check (`request` or `reply`). Available values: `"request"`, `"reply"` Default: `reply`.
- `hex_id` (String) `remote_id` as a hex string. This value is generated by cloudflare.
- `psk` (String, Sensitive) Pre shared key to be used with the IPsec tunnel. If left unset, it will be autogenerated.
- `remote_id` (String) ID to be used while setting up the IPsec tunnel. This value is generated by cloudflare.
- `user_id` (String) `remote_id` in the form of an email address. This value is generated by cloudflare.

### Read-Only

- `id` (String) The ID of this resource.

## Import

An existing IPsec tunnel can be imported using the account ID and tunnel ID
Import is supported using the following syntax:

```
```shell
$ terraform import cloudflare_ipsec_tunnel.example d41d8cd98f00b204e9800998ecf8427e/cb029e245cfdd66dc8d2e570d5dd3322
```
1 change: 1 addition & 0 deletions examples/resources/cloudflare_ipsec_tunnel/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$ terraform import cloudflare_ipsec_tunnel.example d41d8cd98f00b204e9800998ecf8427e/cb029e245cfdd66dc8d2e570d5dd3322
12 changes: 12 additions & 0 deletions examples/resources/cloudflare_ipsec_tunnel/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "cloudflare_ipsec_tunnel" "example" {
account_id = "c4a7362d577a6c3019a474fd6f485821"
name = "IPsec_1"
customer_endpoint = "203.0.113.1"
cloudflare_endpoint = "203.0.113.1"
interface_address = "192.0.2.0/31"
description = "Tunnel for ISP X"
health_check_enabled = true
health_check_target = "203.0.113.1"
health_check_type = "reply"
psk = "asdf12341234"
}
1 change: 1 addition & 0 deletions internal/provider/resource_cloudflare_ipsec_tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func resourceCloudflareIPsecTunnel() *schema.Resource {
Importer: &schema.ResourceImporter{
StateContext: resourceCloudflareIPsecTunnelImport,
},
Description: "Provides a resource, that manages IPsec tunnels for Magic Transit.",
}
}

Expand Down
79 changes: 47 additions & 32 deletions internal/provider/schema_cloudflare_ipsec_tunnel.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package provider

import (
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)
Expand All @@ -14,66 +16,79 @@ func resourceCloudflareIPsecTunnelSchema() map[string]*schema.Schema {
ForceNew: true,
},
"name": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
Description: "Name of the IPsec tunnel.",
},
"customer_endpoint": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
Description: "IP address assigned to the customer side of the IPsec tunnel.",
},
"cloudflare_endpoint": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
Description: "IP address assigned to the Cloudflare side of the IPsec tunnel.",
},
"interface_address": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
Description: "31-bit prefix (/31 in CIDR notation) supporting 2 hosts, one for each side of the tunnel.",
},
"description": {
Type: schema.TypeString,
Optional: true,
Type: schema.TypeString,
Optional: true,
Description: "An optional description of the IPsec tunnel.",
},
"health_check_enabled": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "Specifies if ICMP tunnel health checks are enabled. Default: `true`.",
},
"health_check_target": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "The IP address of the customer endpoint that will receive tunnel health checks. Default: `<customer_gre_endpoint>`.",
},
"health_check_type": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{"request", "reply"}, false),
Description: fmt.Sprintf("Specifies the ICMP echo type for the health check (`request` or `reply`). %s Default: `reply`.", renderAvailableDocumentationValuesStringSlice([]string{"request", "reply"})),
},
"psk": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Sensitive: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
Sensitive: true,
Description: "Pre shared key to be used with the IPsec tunnel. If left unset, it will be autogenerated.",
},
"hex_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "`remote_id` as a hex string. This value is generated by cloudflare.",
},
"user_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "`remote_id` in the form of an email address. This value is generated by cloudflare.",
},
"fqdn_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "`remote_id` in the form of a fqdn. This value is generated by cloudflare.",
},
"remote_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "ID to be used while setting up the IPsec tunnel. This value is generated by cloudflare.",
},
}
}
41 changes: 0 additions & 41 deletions templates/resources/cloudflare_ipsec_tunnel.md

This file was deleted.

0 comments on commit 7eb814f

Please sign in to comment.