From 9e83dc2be24eda2f1e3beb89b0153b06a49bea05 Mon Sep 17 00:00:00 2001 From: septikus Date: Fri, 13 Dec 2024 08:20:45 -0800 Subject: [PATCH] Add `group` field to `google_network_connectivity_spoke` (#12537) --- mmv1/products/networkconnectivity/Spoke.yaml | 11 +++++ ...ity_spoke_linked_vpc_network_group.tf.tmpl | 40 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_group.tf.tmpl diff --git a/mmv1/products/networkconnectivity/Spoke.yaml b/mmv1/products/networkconnectivity/Spoke.yaml index b30943cd5866..4ab3309a7845 100644 --- a/mmv1/products/networkconnectivity/Spoke.yaml +++ b/mmv1/products/networkconnectivity/Spoke.yaml @@ -44,6 +44,12 @@ examples: network_name: 'net' hub_name: 'hub1' spoke_name: 'spoke1' + - name: 'network_connectivity_spoke_linked_vpc_network_group' + primary_resource_id: 'primary' + vars: + network_name: 'net-spoke' + hub_name: 'hub1-spoke' + spoke_name: 'group-spoke1' - name: 'network_connectivity_spoke_router_appliance_basic' primary_resource_id: 'primary' vars: @@ -122,6 +128,11 @@ properties: immutable: true resource: 'hub' imports: 'name' + - name: 'group' + type: String + description: The name of the group that this spoke is associated with. + immutable: true + default_from_api: true - name: 'linkedVpnTunnels' type: NestedObject description: The URIs of linked VPN tunnel resources diff --git a/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_group.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_group.tf.tmpl new file mode 100644 index 000000000000..1ff1a1695edc --- /dev/null +++ b/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_group.tf.tmpl @@ -0,0 +1,40 @@ +resource "google_compute_network" "network" { + name = "{{index $.Vars "network_name"}}" + auto_create_subnetworks = false +} + +resource "google_network_connectivity_hub" "basic_hub" { + name = "{{index $.Vars "hub_name"}}" + description = "A sample hub" + labels = { + label-two = "value-one" + } +} + +resource "google_network_connectivity_group" "default_group" { + hub = google_network_connectivity_hub.basic_hub.id + name = "default" + description = "A sample hub group" +} + +resource "google_network_connectivity_spoke" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "spoke_name"}}" + location = "global" + description = "A sample spoke with a linked VPC" + labels = { + label-one = "value-one" + } + hub = google_network_connectivity_hub.basic_hub.id + linked_vpc_network { + exclude_export_ranges = [ + "198.51.100.0/24", + "10.10.0.0/16" + ] + include_export_ranges = [ + "198.51.100.0/23", + "10.0.0.0/8" + ] + uri = google_compute_network.network.self_link + } + group = google_network_connectivity_group.default_group.id +}