Skip to content

Commit b2b4085

Browse files
Updates to add GCE_VM_IP to endpoint type options (#6182) (#11997)
Signed-off-by: Modular Magician <[email protected]>
1 parent cf119eb commit b2b4085

5 files changed

+59
-3
lines changed

.changelog/6182.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
compute: added `GCE_VM_IP` support to `google_compute_network_endpoint_group` resource.
3+
```

google/resource_compute_global_forwarding_rule_generated_test.go

+25
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,27 @@ func TestAccComputeGlobalForwardingRule_globalForwardingRuleHybridExample(t *tes
200200
func testAccComputeGlobalForwardingRule_globalForwardingRuleHybridExample(context map[string]interface{}) string {
201201
return Nprintf(`
202202
// Roughly mirrors https://cloud.google.com/load-balancing/docs/https/setting-up-ext-https-hybrid
203+
variable "subnetwork_cidr" {
204+
default = "10.0.0.0/24"
205+
}
203206
204207
resource "google_compute_network" "default" {
205208
name = "tf-test-my-network%{random_suffix}"
206209
}
207210
211+
resource "google_compute_network" "internal" {
212+
name = "tf-test-my-internal-network%{random_suffix}"
213+
auto_create_subnetworks = false
214+
}
215+
216+
resource "google_compute_subnetwork" "internal"{
217+
name = "tf-test-my-subnetwork%{random_suffix}"
218+
network = google_compute_network.internal.id
219+
ip_cidr_range = var.subnetwork_cidr
220+
region = "us-central1"
221+
private_ip_google_access= true
222+
}
223+
208224
// Zonal NEG with GCE_VM_IP_PORT
209225
resource "google_compute_network_endpoint_group" "default" {
210226
name = "tf-test-default-neg%{random_suffix}"
@@ -214,6 +230,15 @@ resource "google_compute_network_endpoint_group" "default" {
214230
network_endpoint_type = "GCE_VM_IP_PORT"
215231
}
216232
233+
// Zonal NEG with GCE_VM_IP
234+
resource "google_compute_network_endpoint_group" "internal" {
235+
name = "tf-test-internal-neg%{random_suffix}"
236+
network = google_compute_network.internal.id
237+
subnetwork = google_compute_subnetwork.internal.id
238+
zone = "us-central1-a"
239+
network_endpoint_type = "GCE_VM_IP"
240+
}
241+
217242
// Hybrid connectivity NEG
218243
resource "google_compute_network_endpoint_group" "hybrid" {
219244
name = "tf-test-hybrid-neg%{random_suffix}"

google/resource_compute_network_endpoint_group.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,16 @@ you create the resource.`,
7878
Type: schema.TypeString,
7979
Optional: true,
8080
ForceNew: true,
81-
ValidateFunc: validateEnum([]string{"GCE_VM_IP_PORT", "NON_GCP_PRIVATE_IP_PORT", ""}),
81+
ValidateFunc: validateEnum([]string{"GCE_VM_IP", "GCE_VM_IP_PORT", "NON_GCP_PRIVATE_IP_PORT", ""}),
8282
Description: `Type of network endpoints in this network endpoint group.
8383
NON_GCP_PRIVATE_IP_PORT is used for hybrid connectivity network
8484
endpoint groups (see https://cloud.google.com/load-balancing/docs/hybrid).
8585
Note that NON_GCP_PRIVATE_IP_PORT can only be used with Backend Services
8686
that 1) have the following load balancing schemes: EXTERNAL, EXTERNAL_MANAGED,
8787
INTERNAL_MANAGED, and INTERNAL_SELF_MANAGED and 2) support the RATE or
88-
CONNECTION balancing modes. Default value: "GCE_VM_IP_PORT" Possible values: ["GCE_VM_IP_PORT", "NON_GCP_PRIVATE_IP_PORT"]`,
88+
CONNECTION balancing modes.
89+
90+
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"]`,
8991
Default: "GCE_VM_IP_PORT",
9092
},
9193
"subnetwork": {

website/docs/r/compute_global_forwarding_rule.html.markdown

+25
Original file line numberDiff line numberDiff line change
@@ -776,11 +776,27 @@ resource "google_compute_backend_service" "default" {
776776

777777
```hcl
778778
// Roughly mirrors https://cloud.google.com/load-balancing/docs/https/setting-up-ext-https-hybrid
779+
variable "subnetwork_cidr" {
780+
default = "10.0.0.0/24"
781+
}
779782
780783
resource "google_compute_network" "default" {
781784
name = "my-network"
782785
}
783786
787+
resource "google_compute_network" "internal" {
788+
name = "my-internal-network"
789+
auto_create_subnetworks = false
790+
}
791+
792+
resource "google_compute_subnetwork" "internal"{
793+
name = "my-subnetwork"
794+
network = google_compute_network.internal.id
795+
ip_cidr_range = var.subnetwork_cidr
796+
region = "us-central1"
797+
private_ip_google_access= true
798+
}
799+
784800
// Zonal NEG with GCE_VM_IP_PORT
785801
resource "google_compute_network_endpoint_group" "default" {
786802
name = "default-neg"
@@ -790,6 +806,15 @@ resource "google_compute_network_endpoint_group" "default" {
790806
network_endpoint_type = "GCE_VM_IP_PORT"
791807
}
792808
809+
// Zonal NEG with GCE_VM_IP
810+
resource "google_compute_network_endpoint_group" "internal" {
811+
name = "internal-neg"
812+
network = google_compute_network.internal.id
813+
subnetwork = google_compute_subnetwork.internal.id
814+
zone = "us-central1-a"
815+
network_endpoint_type = "GCE_VM_IP"
816+
}
817+
793818
// Hybrid connectivity NEG
794819
resource "google_compute_network_endpoint_group" "hybrid" {
795820
name = "hybrid-neg"

website/docs/r/compute_network_endpoint_group.html.markdown

+2-1
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,9 @@ The following arguments are supported:
141141
that 1) have the following load balancing schemes: EXTERNAL, EXTERNAL_MANAGED,
142142
INTERNAL_MANAGED, and INTERNAL_SELF_MANAGED and 2) support the RATE or
143143
CONNECTION balancing modes.
144+
Possible values include: GCE_VM_IP, GCE_VM_IP_PORT, and NON_GCP_PRIVATE_IP_PORT.
144145
Default value is `GCE_VM_IP_PORT`.
145-
Possible values are `GCE_VM_IP_PORT` and `NON_GCP_PRIVATE_IP_PORT`.
146+
Possible values are `GCE_VM_IP`, `GCE_VM_IP_PORT`, and `NON_GCP_PRIVATE_IP_PORT`.
146147

147148
* `subnetwork` -
148149
(Optional)

0 commit comments

Comments
 (0)