diff --git a/.changelog/6182.txt b/.changelog/6182.txt new file mode 100644 index 00000000000..08d6d59384f --- /dev/null +++ b/.changelog/6182.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +compute: added `GCE_VM_IP` support to `google_compute_network_endpoint_group` resource. +``` diff --git a/google/resource_compute_global_forwarding_rule_generated_test.go b/google/resource_compute_global_forwarding_rule_generated_test.go index babb7252269..eaf8647ffe9 100644 --- a/google/resource_compute_global_forwarding_rule_generated_test.go +++ b/google/resource_compute_global_forwarding_rule_generated_test.go @@ -200,11 +200,27 @@ func TestAccComputeGlobalForwardingRule_globalForwardingRuleHybridExample(t *tes func testAccComputeGlobalForwardingRule_globalForwardingRuleHybridExample(context map[string]interface{}) string { return Nprintf(` // Roughly mirrors https://cloud.google.com/load-balancing/docs/https/setting-up-ext-https-hybrid +variable "subnetwork_cidr" { + default = "10.0.0.0/24" +} resource "google_compute_network" "default" { name = "tf-test-my-network%{random_suffix}" } +resource "google_compute_network" "internal" { + name = "tf-test-my-internal-network%{random_suffix}" + auto_create_subnetworks = false +} + +resource "google_compute_subnetwork" "internal"{ + name = "tf-test-my-subnetwork%{random_suffix}" + network = google_compute_network.internal.id + ip_cidr_range = var.subnetwork_cidr + region = "us-central1" + private_ip_google_access= true +} + // Zonal NEG with GCE_VM_IP_PORT resource "google_compute_network_endpoint_group" "default" { name = "tf-test-default-neg%{random_suffix}" @@ -214,6 +230,15 @@ resource "google_compute_network_endpoint_group" "default" { network_endpoint_type = "GCE_VM_IP_PORT" } +// Zonal NEG with GCE_VM_IP +resource "google_compute_network_endpoint_group" "internal" { + name = "tf-test-internal-neg%{random_suffix}" + network = google_compute_network.internal.id + subnetwork = google_compute_subnetwork.internal.id + zone = "us-central1-a" + network_endpoint_type = "GCE_VM_IP" +} + // Hybrid connectivity NEG resource "google_compute_network_endpoint_group" "hybrid" { name = "tf-test-hybrid-neg%{random_suffix}" diff --git a/google/resource_compute_network_endpoint_group.go b/google/resource_compute_network_endpoint_group.go index 12a8531ec63..c6675bd2d88 100644 --- a/google/resource_compute_network_endpoint_group.go +++ b/google/resource_compute_network_endpoint_group.go @@ -78,14 +78,16 @@ you create the resource.`, Type: schema.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validateEnum([]string{"GCE_VM_IP_PORT", "NON_GCP_PRIVATE_IP_PORT", ""}), + ValidateFunc: validateEnum([]string{"GCE_VM_IP", "GCE_VM_IP_PORT", "NON_GCP_PRIVATE_IP_PORT", ""}), Description: `Type of network endpoints in this network endpoint group. NON_GCP_PRIVATE_IP_PORT is used for hybrid connectivity network endpoint groups (see https://cloud.google.com/load-balancing/docs/hybrid). Note that NON_GCP_PRIVATE_IP_PORT can only be used with Backend Services that 1) have the following load balancing schemes: EXTERNAL, EXTERNAL_MANAGED, INTERNAL_MANAGED, and INTERNAL_SELF_MANAGED and 2) support the RATE or -CONNECTION balancing modes. Default value: "GCE_VM_IP_PORT" Possible values: ["GCE_VM_IP_PORT", "NON_GCP_PRIVATE_IP_PORT"]`, +CONNECTION balancing modes. + +Possible values include: GCE_VM_IP, GCE_VM_IP_PORT, and NON_GCP_PRIVATE_IP_PORT. Default value: "GCE_VM_IP_PORT" Possible values: ["GCE_VM_IP", "GCE_VM_IP_PORT", "NON_GCP_PRIVATE_IP_PORT"]`, Default: "GCE_VM_IP_PORT", }, "subnetwork": { diff --git a/website/docs/r/compute_global_forwarding_rule.html.markdown b/website/docs/r/compute_global_forwarding_rule.html.markdown index 3fdfc682300..64bf100f77e 100644 --- a/website/docs/r/compute_global_forwarding_rule.html.markdown +++ b/website/docs/r/compute_global_forwarding_rule.html.markdown @@ -776,11 +776,27 @@ resource "google_compute_backend_service" "default" { ```hcl // Roughly mirrors https://cloud.google.com/load-balancing/docs/https/setting-up-ext-https-hybrid +variable "subnetwork_cidr" { + default = "10.0.0.0/24" +} resource "google_compute_network" "default" { name = "my-network" } +resource "google_compute_network" "internal" { + name = "my-internal-network" + auto_create_subnetworks = false +} + +resource "google_compute_subnetwork" "internal"{ + name = "my-subnetwork" + network = google_compute_network.internal.id + ip_cidr_range = var.subnetwork_cidr + region = "us-central1" + private_ip_google_access= true +} + // Zonal NEG with GCE_VM_IP_PORT resource "google_compute_network_endpoint_group" "default" { name = "default-neg" @@ -790,6 +806,15 @@ resource "google_compute_network_endpoint_group" "default" { network_endpoint_type = "GCE_VM_IP_PORT" } +// Zonal NEG with GCE_VM_IP +resource "google_compute_network_endpoint_group" "internal" { + name = "internal-neg" + network = google_compute_network.internal.id + subnetwork = google_compute_subnetwork.internal.id + zone = "us-central1-a" + network_endpoint_type = "GCE_VM_IP" +} + // Hybrid connectivity NEG resource "google_compute_network_endpoint_group" "hybrid" { name = "hybrid-neg" diff --git a/website/docs/r/compute_network_endpoint_group.html.markdown b/website/docs/r/compute_network_endpoint_group.html.markdown index d6eb1c80042..4a8a8331f1a 100644 --- a/website/docs/r/compute_network_endpoint_group.html.markdown +++ b/website/docs/r/compute_network_endpoint_group.html.markdown @@ -141,8 +141,9 @@ The following arguments are supported: that 1) have the following load balancing schemes: EXTERNAL, EXTERNAL_MANAGED, INTERNAL_MANAGED, and INTERNAL_SELF_MANAGED and 2) support the RATE or CONNECTION balancing modes. + Possible values include: GCE_VM_IP, GCE_VM_IP_PORT, and NON_GCP_PRIVATE_IP_PORT. Default value is `GCE_VM_IP_PORT`. - Possible values are `GCE_VM_IP_PORT` and `NON_GCP_PRIVATE_IP_PORT`. + Possible values are `GCE_VM_IP`, `GCE_VM_IP_PORT`, and `NON_GCP_PRIVATE_IP_PORT`. * `subnetwork` - (Optional)