Skip to content

Commit

Permalink
TF Support for NCC Star Topology (#12540)
Browse files Browse the repository at this point in the history
  • Loading branch information
akshat-jindal-nit authored Dec 17, 2024
1 parent c8d6ede commit 765f91a
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mmv1/products/networkconnectivity/Hub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ examples:
primary_resource_id: 'primary'
vars:
resource_name: 'basic'
- name: 'network_connectivity_hub_mesh_topology'
primary_resource_id: 'primary'
vars:
resource_name: 'mesh'
- name: 'network_connectivity_hub_star_topology'
primary_resource_id: 'primary'
vars:
resource_name: 'star'
parameters:
properties:
- name: 'name'
Expand Down Expand Up @@ -92,6 +100,14 @@ properties:
- name: 'uri'
type: String
description: The URI of the VPC network.
- name: 'presetTopology'
type: Enum
description: Optional. The topology implemented in this hub. Currently, this field is only used when policyMode = PRESET. The available preset topologies are MESH and STAR. If presetTopology is unspecified and policyMode = PRESET, the presetTopology defaults to MESH. When policyMode = CUSTOM, the presetTopology is set to PRESET_TOPOLOGY_UNSPECIFIED.
immutable: true
enum_values:
- 'MESH'
- 'STAR'
default_from_api: true
- name: 'exportPsc'
type: Boolean
description: Whether Private Service Connect transitivity is enabled for the hub. If true, Private Service Connect endpoints in VPC spokes attached to the hub are made accessible to other VPC spokes attached to the hub. The default value is false.
Expand Down
7 changes: 7 additions & 0 deletions mmv1/products/networkconnectivity/Spoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ examples:
hub_name: "hub-basic"
spoke_name: "vpc-spoke"
producer_spoke_name: "producer-spoke"
- name: 'network_connectivity_spoke_center_group'
primary_resource_id: 'primary'
vars:
hub_name: "hub-basic"
spoke_name: "vpc-spoke"
auto_accept_project_1_name: "foo"
auto_accept_project_2_name: "bar"
parameters:
- name: 'location'
type: String
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource "google_network_connectivity_hub" "{{$.PrimaryResourceId}}" {
name = "{{index $.Vars "resource_name"}}"
description = "A sample mesh hub"
labels = {
label-one = "value-one"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "google_network_connectivity_hub" "{{$.PrimaryResourceId}}" {
name = "{{index $.Vars "resource_name"}}"
description = "A sample star hub"
labels = {
label-one = "value-one"
}
preset_topology = "STAR"

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
resource "google_compute_network" "network" {
name = "tf-net"
auto_create_subnetworks = false
}

resource "google_network_connectivity_hub" "star_hub" {
name = "{{index $.Vars "hub_name"}}"
preset_topology = "STAR"
}

resource "google_network_connectivity_group" "center_group" {
name = "center" # (default , center , edge)
hub = google_network_connectivity_hub.star_hub.id
auto_accept {
auto_accept_projects = [
"foo%{random_suffix}",
"bar%{random_suffix}",
]
}
}

resource "google_network_connectivity_spoke" "primary" {
name = "{{index $.Vars "spoke_name"}}"
location = "global"
description = "A sample spoke"
labels = {
label-one = "value-one"
}
hub = google_network_connectivity_hub.star_hub.id
group = google_network_connectivity_group.center_group.id

linked_vpc_network {
uri = google_compute_network.network.self_link
}
}

0 comments on commit 765f91a

Please sign in to comment.