diff --git a/Makefile b/Makefile index 89fd9ac..cd69a21 100644 --- a/Makefile +++ b/Makefile @@ -69,6 +69,7 @@ docker_test_integration: docker_test_lint: docker run --rm -it \ -v "$(CURDIR)":/workspace \ + -e ENABLE_BPMETADATA=1 \ $(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \ /usr/local/bin/test_lint.sh @@ -77,8 +78,9 @@ docker_test_lint: docker_generate_docs: docker run --rm -it \ -v "$(CURDIR)":/workspace \ + -e ENABLE_BPMETADATA=1 \ $(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \ - /bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs' + /bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs display' # Alias for backwards compatibility .PHONY: generate_docs diff --git a/metadata.display.yaml b/metadata.display.yaml new file mode 100644 index 0000000..09b3869 --- /dev/null +++ b/metadata.display.yaml @@ -0,0 +1,52 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: blueprints.cloud.google.com/v1alpha1 +kind: BlueprintMetadata +metadata: + name: terraform-google-cloud-router-display + annotations: + config.kubernetes.io/local-config: "true" +spec: + info: + source: + repo: https://github.com/terraform-google-modules/terraform-google-cloud-router.git + sourceType: git + ui: + input: + variables: + bgp: + name: bgp + title: Bgp + description: + name: description + title: Description + encrypted_interconnect_router: + name: encrypted_interconnect_router + title: Encrypted Interconnect Router + name: + name: name + title: Name + nats: + name: nats + title: Nats + network: + name: network + title: Network + project: + name: project + title: Project + region: + name: region + title: Region diff --git a/metadata.yaml b/metadata.yaml index b742f7f..bada61c 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -1,4 +1,4 @@ -# Copyright 2024 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,6 +43,29 @@ spec: location: examples/simple_example interfaces: variables: + - name: name + description: Name of the router + varType: string + required: true + - name: network + description: A reference to the network to which this router belongs + varType: string + required: true + - name: project + description: The project ID to deploy to + varType: string + required: true + - name: region + description: Region where the router resides + varType: string + required: true + - name: description + description: An optional description of this resource + varType: string + - name: encrypted_interconnect_router + description: An optional field to indicate if a router is dedicated to use with encrypted Interconnect Attachment + varType: bool + defaultValue: false - name: bgp description: BGP information specific to this router. varType: |- @@ -56,13 +79,6 @@ spec: })), []) keepalive_interval = optional(number) }) - - name: description - description: An optional description of this resource - varType: string - - name: name - description: Name of the router - varType: string - required: true - name: nats description: NATs to deploy on this router. varType: |- @@ -71,6 +87,7 @@ spec: nat_ip_allocate_option = optional(string) source_subnetwork_ip_ranges_to_nat = optional(string) nat_ips = optional(list(string), []) + drain_nat_ips = optional(list(string), []) min_ports_per_vm = optional(number) max_ports_per_vm = optional(number) udp_idle_timeout_sec = optional(number) @@ -94,18 +111,6 @@ spec: })) defaultValue: [] - - name: network - description: A reference to the network to which this router belongs - varType: string - required: true - - name: project - description: The project ID to deploy to - varType: string - required: true - - name: region - description: Region where the router resides - varType: string - required: true outputs: - name: nat description: Created NATs @@ -120,3 +125,6 @@ spec: - cloudresourcemanager.googleapis.com - serviceusage.googleapis.com - compute.googleapis.com + providerVersions: + - source: hashicorp/google + version: ">= 4.51, < 7" diff --git a/modules/interconnect_attachment/metadata.display.yaml b/modules/interconnect_attachment/metadata.display.yaml new file mode 100644 index 0000000..798d592 --- /dev/null +++ b/modules/interconnect_attachment/metadata.display.yaml @@ -0,0 +1,84 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: blueprints.cloud.google.com/v1alpha1 +kind: BlueprintMetadata +metadata: + name: terraform-google-cloud-router-interconnect-attachment-display + annotations: + config.kubernetes.io/local-config: "true" +spec: + info: + title: Interconnect Attachment + source: + repo: https://github.com/terraform-google-modules/terraform-google-cloud-router.git + sourceType: git + dir: /modules/interconnect_attachment + ui: + input: + variables: + admin_enabled: + name: admin_enabled + title: Admin Enabled + bandwidth: + name: bandwidth + title: Bandwidth + candidate_subnets: + name: candidate_subnets + title: Candidate Subnets + create_interface: + name: create_interface + title: Create Interface + description: + name: description + title: Description + edge_availability_domain: + name: edge_availability_domain + title: Edge Availability Domain + encryption: + name: encryption + title: Encryption + interconnect: + name: interconnect + title: Interconnect + interface: + name: interface + title: Interface + ipsec_internal_addresses: + name: ipsec_internal_addresses + title: Ipsec Internal Addresses + mtu: + name: mtu + title: Mtu + name: + name: name + title: Name + peer: + name: peer + title: Peer + project: + name: project + title: Project + region: + name: region + title: Region + router: + name: router + title: Router + type: + name: type + title: Type + vlan_tag8021q: + name: vlan_tag8021q + title: Vlan Tag8021q diff --git a/modules/interconnect_attachment/metadata.yaml b/modules/interconnect_attachment/metadata.yaml index 65c7e58..194cff3 100644 --- a/modules/interconnect_attachment/metadata.yaml +++ b/modules/interconnect_attachment/metadata.yaml @@ -1,4 +1,4 @@ -# Copyright 2024 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,38 +40,71 @@ spec: location: examples/simple_example interfaces: variables: + - name: name + description: The name of the interconnect attachment + varType: string + required: true + - name: project + description: The project ID to deploy to + varType: string + required: true + - name: router + description: Name of the router the attachment resides + varType: string + required: true + - name: region + description: Region where the attachment resides + varType: string + required: true + - name: interconnect + description: URL of the underlying Interconnect object that this attachment's traffic will traverse through. + varType: string + defaultValue: "" - name: admin_enabled description: Whether the VLAN attachment is enabled or disabled varType: bool defaultValue: true + - name: type + description: The type of InterconnectAttachment you wish to create + varType: string + defaultValue: DEDICATED - name: bandwidth description: Provisioned bandwidth capacity for the interconnect attachment varType: string defaultValue: BPS_10G + - name: mtu + description: Maximum Transmission Unit (MTU), in bytes, of packets passing through this interconnect attachment. Currently, only 1440 and 1500 are allowed. If not specified, the value will default to 1440. + varType: string + - name: edge_availability_domain + description: Desired availability domain for the attachment. Only available for type PARTNER, at creation time. + varType: string + - name: description + description: An optional description of this resource + varType: string - name: candidate_subnets description: Up to 16 candidate prefixes that can be used to restrict the allocation of cloudRouterIpAddress and customerRouterIpAddress for this attachment. All prefixes must be within link-local address space (169.254.0.0/16) and must be /29 or shorter (/28, /27, etc). varType: list(string) - - name: description - description: An optional description of this resource + - name: vlan_tag8021q + description: The IEEE 802.1Q VLAN tag for this attachment, in the range 2-4094. varType: string - - name: interconnect - description: URL of the underlying Interconnect object that this attachment's traffic will traverse through. + - name: encryption + description: Indicates the user-supplied encryption option of this interconnect attachment. varType: string - required: true + defaultValue: NONE + - name: ipsec_internal_addresses + description: URL of addresses that have been reserved for the interconnect attachment, Used only for interconnect attachment that has the encryption option as IPSEC. + varType: list(string) + defaultValue: [] + - name: create_interface + description: Whether to create router interface (and peer) for this attachment. Set this to false for PARTNER type. + varType: bool + defaultValue: true - name: interface description: Interface to deploy for this attachment. varType: |- object({ name = string }) - required: true - - name: mtu - description: Maximum Transmission Unit (MTU), in bytes, of packets passing through this interconnect attachment. Currently, only 1440 and 1500 are allowed. If not specified, the value will default to 1440. - varType: string - - name: name - description: The name of the interconnect attachment - varType: string - required: true - name: peer description: BGP Peer for this attachment. varType: |- @@ -85,27 +118,11 @@ spec: min_receive_interval = optional(number) multiplier = optional(number) })) + md5_authentication_key = optional(object({ + name = string + key = string + })) }) - required: true - - name: project - description: The project ID to deploy to - varType: string - required: true - - name: region - description: Region where the attachment resides - varType: string - required: true - - name: router - description: Name of the router the attachment resides - varType: string - required: true - - name: type - description: The type of InterconnectAttachment you wish to create - varType: string - defaultValue: DEDICATED - - name: vlan_tag8021q - description: The IEEE 802.1Q VLAN tag for this attachment, in the range 2-4094. - varType: string outputs: - name: attachment description: The created attachment @@ -120,3 +137,6 @@ spec: - cloudresourcemanager.googleapis.com - serviceusage.googleapis.com - compute.googleapis.com + providerVersions: + - source: hashicorp/google + version: ">= 4.27, < 7" diff --git a/modules/interface/README.md b/modules/interface/README.md index ea55571..fbc8234 100644 --- a/modules/interface/README.md +++ b/modules/interface/README.md @@ -8,7 +8,7 @@ | interconnect\_attachment | The name or resource link to the VLAN interconnect for this interface | `string` | `null` | no | | ip\_range | IP address and range of the interface | `string` | `null` | no | | name | The name of the interface | `string` | n/a | yes | -| peers | BGP peers for this interface. |
list(object({
name = string
peer_ip_address = string
peer_asn = string
advertised_route_priority = optional(number)
bfd = object({
session_initialization_mode = string
min_transmit_interval = optional(number)
min_receive_interval = optional(number)
multiplier = optional(number)
})
md5_authentication_key = optional(object({
name = string
key = string
}))
})) | `[]` | no |
+| peers | BGP peers for this interface. | list(object({
name = string
peer_ip_address = string
peer_asn = string
advertised_route_priority = optional(number)
zero_advertised_route_priority = optional(bool)
bfd = object({
session_initialization_mode = string
min_transmit_interval = optional(number)
min_receive_interval = optional(number)
multiplier = optional(number)
})
md5_authentication_key = optional(object({
name = string
key = string
}))
})) | `[]` | no |
| project | The project ID to deploy to | `string` | n/a | yes |
| region | Region where the interface resides | `string` | n/a | yes |
| router | Name of the router the interface resides | `string` | n/a | yes |
diff --git a/modules/interface/main.tf b/modules/interface/main.tf
index fd10a7a..43428df 100644
--- a/modules/interface/main.tf
+++ b/modules/interface/main.tf
@@ -30,14 +30,15 @@ resource "google_compute_router_peer" "peers" {
p.name => p
}
- name = each.value.name
- project = google_compute_router_interface.interface.project
- router = google_compute_router_interface.interface.router
- region = google_compute_router_interface.interface.region
- interface = google_compute_router_interface.interface.name
- peer_ip_address = each.value.peer_ip_address
- peer_asn = each.value.peer_asn
- advertised_route_priority = try(each.value.advertised_route_priority, null)
+ name = each.value.name
+ project = google_compute_router_interface.interface.project
+ router = google_compute_router_interface.interface.router
+ region = google_compute_router_interface.interface.region
+ interface = google_compute_router_interface.interface.name
+ peer_ip_address = each.value.peer_ip_address
+ peer_asn = each.value.peer_asn
+ advertised_route_priority = try(each.value.advertised_route_priority, null)
+ zero_advertised_route_priority = each.value.zero_advertised_route_priority
dynamic "bfd" {
for_each = try(each.value.bfd, null) == null ? [] : [""]
diff --git a/modules/interface/metadata.display.yaml b/modules/interface/metadata.display.yaml
new file mode 100644
index 0000000..9fee6a3
--- /dev/null
+++ b/modules/interface/metadata.display.yaml
@@ -0,0 +1,54 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: blueprints.cloud.google.com/v1alpha1
+kind: BlueprintMetadata
+metadata:
+ name: terraform-google-cloud-router-interface-display
+ annotations:
+ config.kubernetes.io/local-config: "true"
+spec:
+ info:
+ title: Interface
+ source:
+ repo: https://github.com/terraform-google-modules/terraform-google-cloud-router.git
+ sourceType: git
+ dir: /modules/interface
+ ui:
+ input:
+ variables:
+ interconnect_attachment:
+ name: interconnect_attachment
+ title: Interconnect Attachment
+ ip_range:
+ name: ip_range
+ title: Ip Range
+ name:
+ name: name
+ title: Name
+ peers:
+ name: peers
+ title: Peers
+ project:
+ name: project
+ title: Project
+ region:
+ name: region
+ title: Region
+ router:
+ name: router
+ title: Router
+ vpn_tunnel:
+ name: vpn_tunnel
+ title: Vpn Tunnel
diff --git a/modules/interface/metadata.yaml b/modules/interface/metadata.yaml
index da261eb..4e58fa0 100644
--- a/modules/interface/metadata.yaml
+++ b/modules/interface/metadata.yaml
@@ -1,4 +1,4 @@
-# Copyright 2024 Google LLC
+# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -40,47 +40,52 @@ spec:
location: examples/simple_example
interfaces:
variables:
- - name: interconnect_attachment
- description: The name or resource link to the VLAN interconnect for this interface
+ - name: name
+ description: The name of the interface
+ varType: string
+ required: true
+ - name: project
+ description: The project ID to deploy to
+ varType: string
+ required: true
+ - name: router
+ description: Name of the router the interface resides
+ varType: string
+ required: true
+ - name: region
+ description: Region where the interface resides
varType: string
+ required: true
- name: ip_range
description: IP address and range of the interface
varType: string
- - name: name
- description: The name of the interface
+ - name: vpn_tunnel
+ description: The name or resource link to the VPN tunnel this interface will be linked to
+ varType: string
+ - name: interconnect_attachment
+ description: The name or resource link to the VLAN interconnect for this interface
varType: string
- required: true
- name: peers
description: BGP peers for this interface.
varType: |-
list(object({
- name = string
- peer_ip_address = string
- peer_asn = string
- advertised_route_priority = optional(number)
+ name = string
+ peer_ip_address = string
+ peer_asn = string
+ advertised_route_priority = optional(number)
+ zero_advertised_route_priority = optional(bool)
bfd = object({
session_initialization_mode = string
min_transmit_interval = optional(number)
min_receive_interval = optional(number)
multiplier = optional(number)
})
+ md5_authentication_key = optional(object({
+ name = string
+ key = string
+ }))
}))
defaultValue: []
- - name: project
- description: The project ID to deploy to
- varType: string
- required: true
- - name: region
- description: Region where the interface resides
- varType: string
- required: true
- - name: router
- description: Name of the router the interface resides
- varType: string
- required: true
- - name: vpn_tunnel
- description: The name or resource link to the VPN tunnel this interface will be linked to
- varType: string
requirements:
roles:
- level: Project
@@ -90,3 +95,6 @@ spec:
- cloudresourcemanager.googleapis.com
- serviceusage.googleapis.com
- compute.googleapis.com
+ providerVersions:
+ - source: hashicorp/google
+ version: ">= 5.12, < 7"
diff --git a/modules/interface/variables.tf b/modules/interface/variables.tf
index 5e08706..7d90fc0 100644
--- a/modules/interface/variables.tf
+++ b/modules/interface/variables.tf
@@ -54,10 +54,11 @@ variable "interconnect_attachment" {
variable "peers" {
type = list(object({
- name = string
- peer_ip_address = string
- peer_asn = string
- advertised_route_priority = optional(number)
+ name = string
+ peer_ip_address = string
+ peer_asn = string
+ advertised_route_priority = optional(number)
+ zero_advertised_route_priority = optional(bool)
bfd = object({
session_initialization_mode = string
min_transmit_interval = optional(number)