Skip to content

Commit

Permalink
add examples and config for NCC star topology
Browse files Browse the repository at this point in the history
  • Loading branch information
akshat-jindal-nit committed Dec 11, 2024
1 parent 2936c3b commit a1ae620
Show file tree
Hide file tree
Showing 5 changed files with 80 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
13 changes: 13 additions & 0 deletions mmv1/products/networkconnectivity/Spoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,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 Expand Up @@ -122,6 +129,12 @@ properties:
immutable: true
resource: 'hub'
imports: 'name'
- name: 'group'
type: ResourceRef
description: Optional. The name of the group that this spoke is associated with.
immutable: true
resource: 'group'
imports: 'name'
- name: 'linkedVpnTunnels'
type: NestedObject
description: The URIs of linked VPN tunnel resources
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 a1ae620

Please sign in to comment.