-
Notifications
You must be signed in to change notification settings - Fork 2k
Add support to create NCC Gateway Spoke #15198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ScottSuarez
merged 6 commits into
GoogleCloudPlatform:main
from
harshithpatte-g:harshithpatte/ncc-gw
Oct 16, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3957d88
add GW spoke
harshithpatte-g 90dea8f
fix descriptions
harshithpatte-g 925a2e6
split the internal ranges and other resources
harshithpatte-g 910701c
update name in the teamcity services file
harshithpatte-g d2fb271
move service connection policy to nccv1
harshithpatte-g aeed52e
address PR comment and update immutability and required fields in Spoke.
harshithpatte-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2024 Google Inc. | ||
# 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. | ||
|
||
--- | ||
name: 'NetworkConnectivityv1' | ||
legacy_name: 'network_connectivity' | ||
display_name: 'Network Connectivity' | ||
versions: | ||
- name: 'ga' | ||
base_url: 'https://networkconnectivity.googleapis.com/v1/' | ||
scopes: | ||
- 'https://www.googleapis.com/auth/cloud-platform' |
30 changes: 30 additions & 0 deletions
30
mmv1/templates/terraform/custom_expand/self_link_from_name_network_connectivity.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{{/* | ||
The license inside this block applies to this file | ||
Copyright 2024 Google Inc. | ||
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. | ||
*/ -}} | ||
func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { | ||
// This method returns a full self link from a partial self link. | ||
if v == nil || v.(string) == "" { | ||
// It does not try to construct anything from empty. | ||
return "", nil | ||
} else if strings.HasPrefix(v.(string), "https://") { | ||
// Anything that starts with a URL scheme is assumed to be a self link worth using. | ||
return v, nil | ||
} | ||
// Anything else is assumed to be a regional resource, with a partial link that begins with the resource name. | ||
// This isn't very likely - it's a last-ditch effort to extract something useful here. We can do a better job | ||
// as soon as MultiResourceRefs are working since we'll know the types that this field is supposed to point to. | ||
url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetworkConnectivityBasePath{{"}}"}}") | ||
if err != nil { | ||
return nil, err | ||
} | ||
return url + v.(string), nil | ||
} |
41 changes: 41 additions & 0 deletions
41
mmv1/templates/terraform/examples/network_connectivity_spoke_gateway.tf.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
resource "google_compute_network" "network" { | ||
provider = google-beta | ||
name = "{{index $.Vars "network_name"}}" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_subnetwork" "subnetwork" { | ||
provider = google-beta | ||
name = "tf-test-subnet%{random_suffix}" | ||
ip_cidr_range = "10.0.0.0/28" | ||
region = "us-central1" | ||
network = google_compute_network.network.self_link | ||
} | ||
|
||
resource "google_network_connectivity_hub" "basic_hub" { | ||
provider = google-beta | ||
name = "{{index $.Vars "hub_name"}}" | ||
description = "A sample hub" | ||
labels = { | ||
label-two = "value-one" | ||
} | ||
preset_topology = "HYBRID_INSPECTION" | ||
} | ||
|
||
resource "google_network_connectivity_spoke" "primary" { | ||
provider = google-beta | ||
name = "{{index $.Vars "spoke_name"}}" | ||
location = "us-central1" | ||
description = "A sample spoke of type Gateway" | ||
labels = { | ||
label-one = "value-one" | ||
} | ||
hub = google_network_connectivity_hub.basic_hub.id | ||
gateway { | ||
ip_range_reservations { | ||
ip_range = "10.0.0.0/23" | ||
} | ||
capacity = "CAPACITY_1_GBPS" | ||
} | ||
group = "gateways" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
resource "google_compute_network" "network" { | ||
provider = google-beta | ||
name = "{{index $.Vars "network_name"}}" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_subnetwork" "subnetwork" { | ||
provider = google-beta | ||
name = "tf-test-subnet%{random_suffix}" | ||
ip_cidr_range = "10.0.0.0/28" | ||
region = "us-central1" | ||
network = google_compute_network.network.self_link | ||
} | ||
|
||
resource "google_network_connectivity_hub" "basic_hub" { | ||
provider = google-beta | ||
name = "{{index $.Vars "hub_name"}}" | ||
description = "A sample hub" | ||
labels = { | ||
label-two = "value-one" | ||
} | ||
preset_topology = "HYBRID_INSPECTION" | ||
} | ||
|
||
resource "google_network_connectivity_spoke" "primary" { | ||
provider = google-beta | ||
name = "{{index $.Vars "ncc_gw_name"}}" | ||
location = "us-central1" | ||
description = "A sample spoke of type Gateway" | ||
labels = { | ||
label-one = "value-one" | ||
} | ||
hub = google_network_connectivity_hub.basic_hub.id | ||
gateway { | ||
ip_range_reservations { | ||
ip_range = "10.0.0.0/23" | ||
} | ||
capacity = "CAPACITY_1_GBPS" | ||
} | ||
group = "gateways" | ||
} | ||
|
||
|
||
resource "google_compute_router" "foobar" { | ||
provider = google-beta | ||
name = "{{index $.Vars "router_name"}}" | ||
bgp { | ||
asn = 64514 | ||
advertise_mode = "CUSTOM" | ||
advertised_groups = ["ALL_SUBNETS"] | ||
advertised_ip_ranges { | ||
range = "1.2.3.4" | ||
} | ||
advertised_ip_ranges { | ||
range = "6.7.0.0/16" | ||
} | ||
} | ||
ncc_gateway = google_network_connectivity_spoke.primary.id | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.