Skip to content
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

network endpoint support long form ids for network endpoint groups #3224

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
custom_expand: "templates/terraform/custom_expand/resource_from_self_link.go.erb"
networkEndpointGroup: !ruby/object:Overrides::Terraform::PropertyOverride
ignore_read: true
diff_suppress_func: compareResourceNames
port: !ruby/object:Overrides::Terraform::PropertyOverride
custom_flatten: templates/terraform/custom_flatten/float64_to_int.go.erb
zone: !ruby/object:Overrides::Terraform::PropertyOverride
Expand Down
3 changes: 3 additions & 0 deletions templates/terraform/encoders/compute_network_endpoint.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-%>
// Network Endpoint Group is a URL parameter only, so replace self-link/path with resource name only.
d.Set("network_endpoint_group", GetResourceNameFromSelfLink(d.Get("network_endpoint_group").(string)))

wrappedReq := map[string]interface{}{
"networkEndpoints": []interface{}{obj},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func testAccComputeNetworkEndpoint_networkEndpointsBasic(context map[string]inte
return Nprintf(`
resource "google_compute_network_endpoint" "default" {
zone = "us-central1-a"
network_endpoint_group = google_compute_network_endpoint_group.neg.name
network_endpoint_group = google_compute_network_endpoint_group.neg.id

instance = google_compute_instance.default.name
ip_address = google_compute_instance.default.network_interface[0].network_ip
Expand All @@ -107,7 +107,7 @@ func testAccComputeNetworkEndpoint_networkEndpointsAdditional(context map[string
return Nprintf(`
resource "google_compute_network_endpoint" "default" {
zone = "us-central1-a"
network_endpoint_group = google_compute_network_endpoint_group.neg.name
network_endpoint_group = google_compute_network_endpoint_group.neg.id

instance = google_compute_instance.default.name
ip_address = google_compute_instance.default.network_interface[0].network_ip
Expand All @@ -116,7 +116,7 @@ resource "google_compute_network_endpoint" "default" {

resource "google_compute_network_endpoint" "add1" {
zone = "us-central1-a"
network_endpoint_group = google_compute_network_endpoint_group.neg.name
network_endpoint_group = google_compute_network_endpoint_group.neg.id

instance = google_compute_instance.default.name
ip_address = google_compute_instance.default.network_interface[0].network_ip
Expand Down