From f98a381aa3fd24f84a0944abc9a7e5962ec20361 Mon Sep 17 00:00:00 2001 From: Charles Treatman Date: Tue, 2 Jul 2024 16:46:40 -0500 Subject: [PATCH] docs: use default template for metal_virtual_circuit --- docs/data-sources/metal_virtual_circuit.md | 57 ++++++++++--------- docs/resources/metal_virtual_circuit.md | 57 ++++++++++--------- .../data-source.tf} | 0 .../equinix_metal_virtual_circuit/import.sh | 1 + .../resource.tf} | 0 .../metal/virtual_circuit/datasource.go | 4 ++ .../metal/virtual_circuit/resource.go | 3 + .../metal_virtual_circuit.md.tmpl | 45 --------------- .../resources/metal_virtual_circuit.md.tmpl | 57 ------------------- 9 files changed, 67 insertions(+), 157 deletions(-) rename examples/data-sources/{metal_virtual_circuit/example_1.tf => equinix_metal_virtual_circuit/data-source.tf} (100%) create mode 100644 examples/resources/equinix_metal_virtual_circuit/import.sh rename examples/resources/{metal_virtual_circuit/example_1.tf => equinix_metal_virtual_circuit/resource.tf} (100%) delete mode 100644 templates/data-sources/metal_virtual_circuit.md.tmpl delete mode 100644 templates/resources/metal_virtual_circuit.md.tmpl diff --git a/docs/data-sources/metal_virtual_circuit.md b/docs/data-sources/metal_virtual_circuit.md index b925852bd..290611389 100644 --- a/docs/data-sources/metal_virtual_circuit.md +++ b/docs/data-sources/metal_virtual_circuit.md @@ -20,30 +20,33 @@ data "equinix_metal_virtual_circuit" "example_vc" { } ``` -## Argument Reference - -The following arguments are supported: - -* `virtual_circuit_id` - (Required) ID of the virtual circuit resource - -## Attributes Reference - -In addition to all arguments above, the following attributes are exported: - -* `name` - Name of the virtual circuit resource. -* `connection_id` - UUID of Connection where the VC is scoped to. -* `status` - Status of the virtal circuit. -* `port_id` - UUID of the Connection Port where the VC is scoped to. -* `project_id` - ID of project to which the VC belongs. -* `vnid`, `nni_vlan`, `nni_nvid` - VLAN parameters, see the [documentation for Equinix Fabric](https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/). -* `description` - Description for the Virtual Circuit resource. -* `tags` - Tags for the Virtual Circuit resource. -* `speed` - Speed of the Virtual Circuit resource. -* `vrf_id` - UUID of the VLAN to associate. -* `peer_asn` - The BGP ASN of the peer. The same ASN may be the used across several VCs, but it cannot be the same as the local_asn of the VRF. -* `subnet` - A subnet from one of the IP blocks associated with the VRF that we will help create an IP reservation for. Can only be either a /30 or /31. - * For a /31 block, it will only have two IP addresses, which will be used for the metal_ip and customer_ip. - * For a /30 block, it will have four IP addresses, but the first and last IP addresses are not usable. We will default to the first usable IP address for the metal_ip. -* `metal_ip` - The Metal IP address for the SVI (Switch Virtual Interface) of the VirtualCircuit. Will default to the first usable IP in the subnet. -* `customer_ip` - The Customer IP address which the CSR switch will peer with. Will default to the other usable IP in the subnet. -* `md5` - The password that can be set for the VRF BGP peer + +## Schema + +### Required + +- `virtual_circuit_id` (String) ID of the virtual circuit to lookup + +### Read-Only + +- `connection_id` (String) UUID of Connection where the VC is scoped to +- `customer_ip` (String) The Customer IP address which the CSR switch will peer with. Will default to the other usable IP in the subnet. +- `description` (String) Description of the virtual circuit +- `id` (String) The ID of this resource. +- `md5` (String, Sensitive) The password that can be set for the VRF BGP peer +- `metal_ip` (String) The Metal IP address for the SVI (Switch Virtual Interface) of the VirtualCircuit. Will default to the first usable IP in the subnet. +- `name` (String) Name of the virtual circuit +- `nni_vlan` (Number) Nni VLAN parameter, see https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/ +- `nni_vnid` (Number) Nni VLAN ID parameter, see https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/ +- `peer_asn` (Number) The BGP ASN of the peer. The same ASN may be the used across several VCs, but it cannot be the same as the local_asn of the VRF. +- `port_id` (String) UUID of the Connection Port where the VC is scoped to +- `project_id` (String) ID of the projct to which the virtual circuit belongs +- `speed` (String) Description of the Virtual Circuit speed. This is for information purposes and is computed when the connection type is shared. +- `status` (String) Status of the virtual circuit +- `subnet` (String) A subnet from one of the IP blocks associated with the VRF that we will help create an IP reservation for. Can only be either a /30 or /31. + * For a /31 block, it will only have two IP addresses, which will be used for the metal_ip and customer_ip. + * For a /30 block, it will have four IP addresses, but the first and last IP addresses are not usable. We will default to the first usable IP address for the metal_ip. +- `tags` (List of String) Tags attached to the virtual circuit +- `vlan_id` (String) UUID of the associated VLAN +- `vnid` (Number) VNID VLAN parameter, see https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/ +- `vrf_id` (String) UUID of the associated VRF diff --git a/docs/resources/metal_virtual_circuit.md b/docs/resources/metal_virtual_circuit.md index 839c78a7d..18fc5efa7 100644 --- a/docs/resources/metal_virtual_circuit.md +++ b/docs/resources/metal_virtual_circuit.md @@ -10,8 +10,6 @@ See the [Virtual Routing and Forwarding documentation](https://deploy.equinix.co ## Example Usage -Pick an existing Project and dedicated Connection, create a VLAN and use `equinix_metal_virtual_circuit` to associate it with a Primary Port of the Connection. - ```terraform locals { project_id = "52000fb2-ee46-4673-93a8-de2c2bdba33c" @@ -36,40 +34,43 @@ resource "equinix_metal_virtual_circuit" "test" { } ``` -## Argument Reference + +## Schema + +### Required -The following arguments are supported: +- `connection_id` (String) UUID of Connection where the VC is scoped to +- `port_id` (String) UUID of the Connection Port where the VC is scoped to +- `project_id` (String) UUID of the Project where the VC is scoped to -* `connection_id` - (Required) UUID of Connection where the VC is scoped to. -* `project_id` - (Required) UUID of the Project where the VC is scoped to. -* `port_id` - (Required) UUID of the Connection Port where the VC is scoped to. -* `nni_vlan` - (Required) Equinix Metal network-to-network VLAN ID. -* `vlan_id` - (Required) UUID of the VLAN to associate. -* `name` - (Optional) Name of the Virtual Circuit resource. -* `description` - (Optional) Description for the Virtual Circuit resource. -* `tags` - (Optional) Tags for the Virtual Circuit resource. -* `speed` - (Optional) Speed of the Virtual Circuit resource. -* `vrf_id` - (Optional) UUID of the VRF to associate. -* `peer_asn` - (Optional, required with `vrf_id`) The BGP ASN of the peer. The same ASN may be the used across several VCs, but it cannot be the same as the local_asn of the VRF. -* `subnet` - (Optional, required with `vrf_id`) A subnet from one of the IP blocks associated with the VRF that we will help create an IP reservation for. Can only be either a /30 or /31. - * For a /31 block, it will only have two IP addresses, which will be used for the metal_ip and customer_ip. - * For a /30 block, it will have four IP addresses, but the first and last IP addresses are not usable. We will default to the first usable IP address for the metal_ip. -* `metal_ip` - (Optional, required with `vrf_id`) The Metal IP address for the SVI (Switch Virtual Interface) of the VirtualCircuit. Will default to the first usable IP in the subnet. -* `customer_ip` - (Optional, required with `vrf_id`) The Customer IP address which the CSR switch will peer with. Will default to the other usable IP in the subnet. -* `md5` - (Optional, only valid with `vrf_id`) The password that can be set for the VRF BGP peer +### Optional -## Attributes Reference +- `customer_ip` (String) The Customer IP address which the CSR switch will peer with. Will default to the other usable IP in the subnet. +- `description` (String) Description of the Virtual Circuit resource +- `md5` (String, Sensitive) The password that can be set for the VRF BGP peer +- `metal_ip` (String) The Metal IP address for the SVI (Switch Virtual Interface) of the VirtualCircuit. Will default to the first usable IP in the subnet. +- `name` (String) Name of the Virtual Circuit resource +- `nni_vlan` (Number) Equinix Metal network-to-network VLAN ID (optional when the connection has mode=tunnel) +- `peer_asn` (Number) The BGP ASN of the peer. The same ASN may be the used across several VCs, but it cannot be the same as the local_asn of the VRF. +- `speed` (String) Description of the Virtual Circuit speed. This is for information purposes and is computed when the connection type is shared. +- `subnet` (String) A subnet from one of the IP blocks associated with the VRF that we will help create an IP reservation for. Can only be either a /30 or /31. + * For a /31 block, it will only have two IP addresses, which will be used for the metal_ip and customer_ip. + * For a /30 block, it will have four IP addresses, but the first and last IP addresses are not usable. We will default to the first usable IP address for the metal_ip. +- `tags` (List of String) Tags attached to the virtual circuit +- `vlan_id` (String) UUID of the VLAN to associate +- `vrf_id` (String) UUID of the VRF to associate -In addition to all arguments above, the following attributes are exported: +### Read-Only -* `status` - Status of the virtal circuit. -* `vnid` - VNID VLAN parameter, see the [documentation for Equinix Fabric](https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/). -* `nni_vnid` - NNI VLAN parameters, see the [documentation for Equinix Fabric](https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/). +- `id` (String) The ID of this resource. +- `nni_vnid` (Number) Nni VLAN ID parameter, see https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/ +- `status` (String) Status of the virtual circuit resource +- `vnid` (Number) VNID VLAN parameter, see https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/ ## Import -This resource can be imported using an existing Virtual Circuit ID: +Import is supported using the following syntax: -```sh +```shell terraform import equinix_metal_virtual_circuit {existing_id} ``` diff --git a/examples/data-sources/metal_virtual_circuit/example_1.tf b/examples/data-sources/equinix_metal_virtual_circuit/data-source.tf similarity index 100% rename from examples/data-sources/metal_virtual_circuit/example_1.tf rename to examples/data-sources/equinix_metal_virtual_circuit/data-source.tf diff --git a/examples/resources/equinix_metal_virtual_circuit/import.sh b/examples/resources/equinix_metal_virtual_circuit/import.sh new file mode 100644 index 000000000..ec216e556 --- /dev/null +++ b/examples/resources/equinix_metal_virtual_circuit/import.sh @@ -0,0 +1 @@ +terraform import equinix_metal_virtual_circuit {existing_id} diff --git a/examples/resources/metal_virtual_circuit/example_1.tf b/examples/resources/equinix_metal_virtual_circuit/resource.tf similarity index 100% rename from examples/resources/metal_virtual_circuit/example_1.tf rename to examples/resources/equinix_metal_virtual_circuit/resource.tf diff --git a/internal/resources/metal/virtual_circuit/datasource.go b/internal/resources/metal/virtual_circuit/datasource.go index e3bedb6c7..c507ae0d9 100644 --- a/internal/resources/metal/virtual_circuit/datasource.go +++ b/internal/resources/metal/virtual_circuit/datasource.go @@ -9,6 +9,10 @@ import ( func DataSource() *schema.Resource { return &schema.Resource{ + Description: `Use this data source to retrieve a virtual circuit resource from [Equinix Fabric - software-defined interconnections](https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/) + +See the [Virtual Routing and Forwarding documentation](https://deploy.equinix.com/developers/docs/metal/layer2-networking/vrf/) for product details and API reference material. +`, ReadContext: dataSourceMetalVirtualCircuitRead, Schema: map[string]*schema.Schema{ diff --git a/internal/resources/metal/virtual_circuit/resource.go b/internal/resources/metal/virtual_circuit/resource.go index f8670a5d5..0ab16e41e 100644 --- a/internal/resources/metal/virtual_circuit/resource.go +++ b/internal/resources/metal/virtual_circuit/resource.go @@ -22,6 +22,9 @@ import ( func Resource() *schema.Resource { return &schema.Resource{ + Description: `Use this resource to associate VLAN with a Dedicated Port from [Equinix Fabric - software-defined interconnections](https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/#associating-a-vlan-with-a-dedicated-port). + +See the [Virtual Routing and Forwarding documentation](https://deploy.equinix.com/developers/docs/metal/layer2-networking/vrf/) for product details and API reference material.`, ReadWithoutTimeout: resourceMetalVirtualCircuitRead, CreateContext: resourceMetalVirtualCircuitCreate, UpdateWithoutTimeout: resourceMetalVirtualCircuitUpdate, diff --git a/templates/data-sources/metal_virtual_circuit.md.tmpl b/templates/data-sources/metal_virtual_circuit.md.tmpl deleted file mode 100644 index a52234654..000000000 --- a/templates/data-sources/metal_virtual_circuit.md.tmpl +++ /dev/null @@ -1,45 +0,0 @@ ---- -subcategory: "Metal" ---- - -{{/* This template serves as a starting point for documentation generation, and can be customized with hardcoded values and/or doc gen templates. - -For example, the {{ .SchemaMarkdown }} template can be used to replace manual schema documentation if descriptions of schema attributes are added in the provider source code. */ -}} - -# equinix_metal_virtual_circuit (Data Source) - -Use this data source to retrieve a virtual circuit resource from [Equinix Fabric - software-defined interconnections](https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/) - -See the [Virtual Routing and Forwarding documentation](https://deploy.equinix.com/developers/docs/metal/layer2-networking/vrf/) for product details and API reference material. - -## Example Usage - -{{tffile "examples/data-sources/metal_virtual_circuit/example_1.tf"}} - -## Argument Reference - -The following arguments are supported: - -* `virtual_circuit_id` - (Required) ID of the virtual circuit resource - -## Attributes Reference - -In addition to all arguments above, the following attributes are exported: - -* `name` - Name of the virtual circuit resource. -* `connection_id` - UUID of Connection where the VC is scoped to. -* `status` - Status of the virtal circuit. -* `port_id` - UUID of the Connection Port where the VC is scoped to. -* `project_id` - ID of project to which the VC belongs. -* `vnid`, `nni_vlan`, `nni_nvid` - VLAN parameters, see the [documentation for Equinix Fabric](https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/). -* `description` - Description for the Virtual Circuit resource. -* `tags` - Tags for the Virtual Circuit resource. -* `speed` - Speed of the Virtual Circuit resource. -* `vrf_id` - UUID of the VLAN to associate. -* `peer_asn` - The BGP ASN of the peer. The same ASN may be the used across several VCs, but it cannot be the same as the local_asn of the VRF. -* `subnet` - A subnet from one of the IP blocks associated with the VRF that we will help create an IP reservation for. Can only be either a /30 or /31. - * For a /31 block, it will only have two IP addresses, which will be used for the metal_ip and customer_ip. - * For a /30 block, it will have four IP addresses, but the first and last IP addresses are not usable. We will default to the first usable IP address for the metal_ip. -* `metal_ip` - The Metal IP address for the SVI (Switch Virtual Interface) of the VirtualCircuit. Will default to the first usable IP in the subnet. -* `customer_ip` - The Customer IP address which the CSR switch will peer with. Will default to the other usable IP in the subnet. -* `md5` - The password that can be set for the VRF BGP peer diff --git a/templates/resources/metal_virtual_circuit.md.tmpl b/templates/resources/metal_virtual_circuit.md.tmpl deleted file mode 100644 index 5631be83f..000000000 --- a/templates/resources/metal_virtual_circuit.md.tmpl +++ /dev/null @@ -1,57 +0,0 @@ ---- -subcategory: "Metal" ---- - -{{/* This template serves as a starting point for documentation generation, and can be customized with hardcoded values and/or doc gen templates. - -For example, the {{ .SchemaMarkdown }} template can be used to replace manual schema documentation if descriptions of schema attributes are added in the provider source code. */ -}} - -# equinix_metal_virtual_circuit (Resource) - -Use this resource to associate VLAN with a Dedicated Port from [Equinix Fabric - software-defined interconnections](https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/#associating-a-vlan-with-a-dedicated-port). - -See the [Virtual Routing and Forwarding documentation](https://deploy.equinix.com/developers/docs/metal/layer2-networking/vrf/) for product details and API reference material. - -## Example Usage - -Pick an existing Project and dedicated Connection, create a VLAN and use `equinix_metal_virtual_circuit` to associate it with a Primary Port of the Connection. - -{{tffile "examples/resources/metal_virtual_circuit/example_1.tf"}} - -## Argument Reference - -The following arguments are supported: - -* `connection_id` - (Required) UUID of Connection where the VC is scoped to. -* `project_id` - (Required) UUID of the Project where the VC is scoped to. -* `port_id` - (Required) UUID of the Connection Port where the VC is scoped to. -* `nni_vlan` - (Required) Equinix Metal network-to-network VLAN ID. -* `vlan_id` - (Required) UUID of the VLAN to associate. -* `name` - (Optional) Name of the Virtual Circuit resource. -* `description` - (Optional) Description for the Virtual Circuit resource. -* `tags` - (Optional) Tags for the Virtual Circuit resource. -* `speed` - (Optional) Speed of the Virtual Circuit resource. -* `vrf_id` - (Optional) UUID of the VRF to associate. -* `peer_asn` - (Optional, required with `vrf_id`) The BGP ASN of the peer. The same ASN may be the used across several VCs, but it cannot be the same as the local_asn of the VRF. -* `subnet` - (Optional, required with `vrf_id`) A subnet from one of the IP blocks associated with the VRF that we will help create an IP reservation for. Can only be either a /30 or /31. - * For a /31 block, it will only have two IP addresses, which will be used for the metal_ip and customer_ip. - * For a /30 block, it will have four IP addresses, but the first and last IP addresses are not usable. We will default to the first usable IP address for the metal_ip. -* `metal_ip` - (Optional, required with `vrf_id`) The Metal IP address for the SVI (Switch Virtual Interface) of the VirtualCircuit. Will default to the first usable IP in the subnet. -* `customer_ip` - (Optional, required with `vrf_id`) The Customer IP address which the CSR switch will peer with. Will default to the other usable IP in the subnet. -* `md5` - (Optional, only valid with `vrf_id`) The password that can be set for the VRF BGP peer - -## Attributes Reference - -In addition to all arguments above, the following attributes are exported: - -* `status` - Status of the virtal circuit. -* `vnid` - VNID VLAN parameter, see the [documentation for Equinix Fabric](https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/). -* `nni_vnid` - NNI VLAN parameters, see the [documentation for Equinix Fabric](https://deploy.equinix.com/developers/docs/metal/interconnections/introduction/). - -## Import - -This resource can be imported using an existing Virtual Circuit ID: - -```sh -terraform import equinix_metal_virtual_circuit {existing_id} -```