Skip to content

Commit

Permalink
Updates to add GCE_VM_IP to endpoint type options (#6182) (#11997)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Jun 30, 2022
1 parent cf119eb commit b2b4085
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/6182.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
compute: added `GCE_VM_IP` support to `google_compute_network_endpoint_group` resource.
```
25 changes: 25 additions & 0 deletions google/resource_compute_global_forwarding_rule_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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}"
Expand Down
6 changes: 4 additions & 2 deletions google/resource_compute_network_endpoint_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
25 changes: 25 additions & 0 deletions website/docs/r/compute_global_forwarding_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/compute_network_endpoint_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b2b4085

Please sign in to comment.