Skip to content

Commit b60bfa4

Browse files
authored
Revert netlb tracking (#3695)
* Revert "Feature/NetLB connection tracking (#5207) (#3655)" This reverts commit d167db2. * Removed NetLB from release notes
1 parent 31d055d commit b60bfa4

File tree

6 files changed

+4
-297
lines changed

6 files changed

+4
-297
lines changed

.changelog/5207.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ IMPROVEMENTS:
1111
* cloudbuild: added field `service_account` to `google_cloudbuild_trigger` ([#3661](https://github.com/hashicorp/terraform-provider-google-beta/pull/3661))
1212
* composer: added field `scheduler_count` to `google_composer_environment` ([#3660](https://github.com/hashicorp/terraform-provider-google-beta/pull/3660))
1313
* compute: Disabled recreation of GCE instances when updating `resource_policies` property ([#3668](https://github.com/hashicorp/terraform-provider-google-beta/pull/3668))
14-
* compute: added NetLB support for Connection Tracking as `connectionTrackingPolicy` in `RegionBackendService` ([#3655](https://github.com/hashicorp/terraform-provider-google-beta/pull/3655))
1514
* container: added support for `logging_config` and `monitoring_config` to `google_container_cluster` ([#3641](https://github.com/hashicorp/terraform-provider-google-beta/pull/3641))
1615
* kms: added support for `import_only` to `google_kms_crypto_key` ([#3659](https://github.com/hashicorp/terraform-provider-google-beta/pull/3659))
1716
* networkservices: boosted the default timeout for `google_network_services_edge_cache_origin` from 30m to 60m ([#3674](https://github.com/hashicorp/terraform-provider-google-beta/pull/3674))

google-beta/resource_compute_region_backend_service.go

Lines changed: 2 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -404,63 +404,6 @@ connections, but still work to finish started).`,
404404
Default: 0,
405405
},
406406

407-
"connection_tracking_policy": {
408-
Type: schema.TypeList,
409-
Optional: true,
410-
Description: `Connection Tracking configuration for this BackendService.
411-
This is available only for Layer 4 Internal Load Balancing and
412-
Network Load Balancing.`,
413-
MaxItems: 1,
414-
Elem: &schema.Resource{
415-
Schema: map[string]*schema.Schema{
416-
"connection_persistence_on_unhealthy_backends": {
417-
Type: schema.TypeString,
418-
Optional: true,
419-
ValidateFunc: validation.StringInSlice([]string{"DEFAULT_FOR_PROTOCOL", "NEVER_PERSIST", "ALWAYS_PERSIST", ""}, false),
420-
Description: `Specifies connection persistence when backends are unhealthy.
421-
422-
If set to 'DEFAULT_FOR_PROTOCOL', the existing connections persist on
423-
unhealthy backends only for connection-oriented protocols (TCP and SCTP)
424-
and only if the Tracking Mode is PER_CONNECTION (default tracking mode)
425-
or the Session Affinity is configured for 5-tuple. They do not persist
426-
for UDP.
427-
428-
If set to 'NEVER_PERSIST', after a backend becomes unhealthy, the existing
429-
connections on the unhealthy backend are never persisted on the unhealthy
430-
backend. They are always diverted to newly selected healthy backends
431-
(unless all backends are unhealthy).
432-
433-
If set to 'ALWAYS_PERSIST', existing connections always persist on
434-
unhealthy backends regardless of protocol and session affinity. It is
435-
generally not recommended to use this mode overriding the default. Default value: "DEFAULT_FOR_PROTOCOL" Possible values: ["DEFAULT_FOR_PROTOCOL", "NEVER_PERSIST", "ALWAYS_PERSIST"]`,
436-
Default: "DEFAULT_FOR_PROTOCOL",
437-
},
438-
"idle_timeout_sec": {
439-
Type: schema.TypeInt,
440-
Computed: true,
441-
Optional: true,
442-
Description: `Specifies how long to keep a Connection Tracking entry while there is
443-
no matching traffic (in seconds).
444-
445-
For L4 ILB the minimum(default) is 10 minutes and maximum is 16 hours.
446-
447-
For NLB the minimum(default) is 60 seconds and the maximum is 16 hours.`,
448-
},
449-
"tracking_mode": {
450-
Type: schema.TypeString,
451-
Optional: true,
452-
ValidateFunc: validation.StringInSlice([]string{"PER_CONNECTION", "PER_SESSION", ""}, false),
453-
Description: `Specifies the key used for connection tracking. There are two options:
454-
'PER_CONNECTION': The Connection Tracking is performed as per the
455-
Connection Key (default Hash Method) for the specific protocol.
456-
457-
'PER_SESSION': The Connection Tracking is performed as per the
458-
configured Session Affinity. It matches the configured Session Affinity. Default value: "PER_CONNECTION" Possible values: ["PER_CONNECTION", "PER_SESSION"]`,
459-
Default: "PER_CONNECTION",
460-
},
461-
},
462-
},
463-
},
464407
"consistent_hash": {
465408
Type: schema.TypeList,
466409
Optional: true,
@@ -908,9 +851,9 @@ If it is not provided, the provider region is used.`,
908851
Type: schema.TypeString,
909852
Computed: true,
910853
Optional: true,
911-
ValidateFunc: validation.StringInSlice([]string{"NONE", "CLIENT_IP", "CLIENT_IP_PORT_PROTO", "CLIENT_IP_PROTO", "GENERATED_COOKIE", "HEADER_FIELD", "HTTP_COOKIE", "CLIENT_IP_NO_DESTINATION", ""}, false),
854+
ValidateFunc: validation.StringInSlice([]string{"NONE", "CLIENT_IP", "CLIENT_IP_PORT_PROTO", "CLIENT_IP_PROTO", "GENERATED_COOKIE", "HEADER_FIELD", "HTTP_COOKIE", ""}, false),
912855
Description: `Type of session affinity to use. The default is NONE. Session affinity is
913-
not applicable if the protocol is UDP. Possible values: ["NONE", "CLIENT_IP", "CLIENT_IP_PORT_PROTO", "CLIENT_IP_PROTO", "GENERATED_COOKIE", "HEADER_FIELD", "HTTP_COOKIE", "CLIENT_IP_NO_DESTINATION"]`,
856+
not applicable if the protocol is UDP. Possible values: ["NONE", "CLIENT_IP", "CLIENT_IP_PORT_PROTO", "CLIENT_IP_PROTO", "GENERATED_COOKIE", "HEADER_FIELD", "HTTP_COOKIE"]`,
914857
},
915858
"timeout_sec": {
916859
Type: schema.TypeInt,
@@ -1204,12 +1147,6 @@ func resourceComputeRegionBackendServiceCreate(d *schema.ResourceData, meta inte
12041147
} else if v, ok := d.GetOkExists("session_affinity"); !isEmptyValue(reflect.ValueOf(sessionAffinityProp)) && (ok || !reflect.DeepEqual(v, sessionAffinityProp)) {
12051148
obj["sessionAffinity"] = sessionAffinityProp
12061149
}
1207-
connectionTrackingPolicyProp, err := expandComputeRegionBackendServiceConnectionTrackingPolicy(d.Get("connection_tracking_policy"), d, config)
1208-
if err != nil {
1209-
return err
1210-
} else if v, ok := d.GetOkExists("connection_tracking_policy"); !isEmptyValue(reflect.ValueOf(connectionTrackingPolicyProp)) && (ok || !reflect.DeepEqual(v, connectionTrackingPolicyProp)) {
1211-
obj["connectionTrackingPolicy"] = connectionTrackingPolicyProp
1212-
}
12131150
timeoutSecProp, err := expandComputeRegionBackendServiceTimeoutSec(d.Get("timeout_sec"), d, config)
12141151
if err != nil {
12151152
return err
@@ -1404,9 +1341,6 @@ func resourceComputeRegionBackendServiceRead(d *schema.ResourceData, meta interf
14041341
if err := d.Set("session_affinity", flattenComputeRegionBackendServiceSessionAffinity(res["sessionAffinity"], d, config)); err != nil {
14051342
return fmt.Errorf("Error reading RegionBackendService: %s", err)
14061343
}
1407-
if err := d.Set("connection_tracking_policy", flattenComputeRegionBackendServiceConnectionTrackingPolicy(res["connectionTrackingPolicy"], d, config)); err != nil {
1408-
return fmt.Errorf("Error reading RegionBackendService: %s", err)
1409-
}
14101344
if err := d.Set("timeout_sec", flattenComputeRegionBackendServiceTimeoutSec(res["timeoutSec"], d, config)); err != nil {
14111345
return fmt.Errorf("Error reading RegionBackendService: %s", err)
14121346
}
@@ -1556,12 +1490,6 @@ func resourceComputeRegionBackendServiceUpdate(d *schema.ResourceData, meta inte
15561490
} else if v, ok := d.GetOkExists("session_affinity"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sessionAffinityProp)) {
15571491
obj["sessionAffinity"] = sessionAffinityProp
15581492
}
1559-
connectionTrackingPolicyProp, err := expandComputeRegionBackendServiceConnectionTrackingPolicy(d.Get("connection_tracking_policy"), d, config)
1560-
if err != nil {
1561-
return err
1562-
} else if v, ok := d.GetOkExists("connection_tracking_policy"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, connectionTrackingPolicyProp)) {
1563-
obj["connectionTrackingPolicy"] = connectionTrackingPolicyProp
1564-
}
15651493
timeoutSecProp, err := expandComputeRegionBackendServiceTimeoutSec(d.Get("timeout_sec"), d, config)
15661494
if err != nil {
15671495
return err
@@ -2748,48 +2676,6 @@ func flattenComputeRegionBackendServiceSessionAffinity(v interface{}, d *schema.
27482676
return v
27492677
}
27502678

2751-
func flattenComputeRegionBackendServiceConnectionTrackingPolicy(v interface{}, d *schema.ResourceData, config *Config) interface{} {
2752-
if v == nil {
2753-
return nil
2754-
}
2755-
original := v.(map[string]interface{})
2756-
if len(original) == 0 {
2757-
return nil
2758-
}
2759-
transformed := make(map[string]interface{})
2760-
transformed["idle_timeout_sec"] =
2761-
flattenComputeRegionBackendServiceConnectionTrackingPolicyIdleTimeoutSec(original["idleTimeoutSec"], d, config)
2762-
transformed["tracking_mode"] =
2763-
flattenComputeRegionBackendServiceConnectionTrackingPolicyTrackingMode(original["trackingMode"], d, config)
2764-
transformed["connection_persistence_on_unhealthy_backends"] =
2765-
flattenComputeRegionBackendServiceConnectionTrackingPolicyConnectionPersistenceOnUnhealthyBackends(original["connectionPersistenceOnUnhealthyBackends"], d, config)
2766-
return []interface{}{transformed}
2767-
}
2768-
func flattenComputeRegionBackendServiceConnectionTrackingPolicyIdleTimeoutSec(v interface{}, d *schema.ResourceData, config *Config) interface{} {
2769-
// Handles the string fixed64 format
2770-
if strVal, ok := v.(string); ok {
2771-
if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil {
2772-
return intVal
2773-
}
2774-
}
2775-
2776-
// number values are represented as float64
2777-
if floatVal, ok := v.(float64); ok {
2778-
intVal := int(floatVal)
2779-
return intVal
2780-
}
2781-
2782-
return v // let terraform core handle it otherwise
2783-
}
2784-
2785-
func flattenComputeRegionBackendServiceConnectionTrackingPolicyTrackingMode(v interface{}, d *schema.ResourceData, config *Config) interface{} {
2786-
return v
2787-
}
2788-
2789-
func flattenComputeRegionBackendServiceConnectionTrackingPolicyConnectionPersistenceOnUnhealthyBackends(v interface{}, d *schema.ResourceData, config *Config) interface{} {
2790-
return v
2791-
}
2792-
27932679
func flattenComputeRegionBackendServiceTimeoutSec(v interface{}, d *schema.ResourceData, config *Config) interface{} {
27942680
// Handles the string fixed64 format
27952681
if strVal, ok := v.(string); ok {
@@ -3769,51 +3655,6 @@ func expandComputeRegionBackendServiceSessionAffinity(v interface{}, d Terraform
37693655
return v, nil
37703656
}
37713657

3772-
func expandComputeRegionBackendServiceConnectionTrackingPolicy(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
3773-
l := v.([]interface{})
3774-
if len(l) == 0 || l[0] == nil {
3775-
return nil, nil
3776-
}
3777-
raw := l[0]
3778-
original := raw.(map[string]interface{})
3779-
transformed := make(map[string]interface{})
3780-
3781-
transformedIdleTimeoutSec, err := expandComputeRegionBackendServiceConnectionTrackingPolicyIdleTimeoutSec(original["idle_timeout_sec"], d, config)
3782-
if err != nil {
3783-
return nil, err
3784-
} else if val := reflect.ValueOf(transformedIdleTimeoutSec); val.IsValid() && !isEmptyValue(val) {
3785-
transformed["idleTimeoutSec"] = transformedIdleTimeoutSec
3786-
}
3787-
3788-
transformedTrackingMode, err := expandComputeRegionBackendServiceConnectionTrackingPolicyTrackingMode(original["tracking_mode"], d, config)
3789-
if err != nil {
3790-
return nil, err
3791-
} else if val := reflect.ValueOf(transformedTrackingMode); val.IsValid() && !isEmptyValue(val) {
3792-
transformed["trackingMode"] = transformedTrackingMode
3793-
}
3794-
3795-
transformedConnectionPersistenceOnUnhealthyBackends, err := expandComputeRegionBackendServiceConnectionTrackingPolicyConnectionPersistenceOnUnhealthyBackends(original["connection_persistence_on_unhealthy_backends"], d, config)
3796-
if err != nil {
3797-
return nil, err
3798-
} else if val := reflect.ValueOf(transformedConnectionPersistenceOnUnhealthyBackends); val.IsValid() && !isEmptyValue(val) {
3799-
transformed["connectionPersistenceOnUnhealthyBackends"] = transformedConnectionPersistenceOnUnhealthyBackends
3800-
}
3801-
3802-
return transformed, nil
3803-
}
3804-
3805-
func expandComputeRegionBackendServiceConnectionTrackingPolicyIdleTimeoutSec(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
3806-
return v, nil
3807-
}
3808-
3809-
func expandComputeRegionBackendServiceConnectionTrackingPolicyTrackingMode(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
3810-
return v, nil
3811-
}
3812-
3813-
func expandComputeRegionBackendServiceConnectionTrackingPolicyConnectionPersistenceOnUnhealthyBackends(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
3814-
return v, nil
3815-
}
3816-
38173658
func expandComputeRegionBackendServiceTimeoutSec(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
38183659
return v, nil
38193660
}

google-beta/resource_compute_region_backend_service_generated_test.go

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -386,59 +386,6 @@ resource "google_compute_subnetwork" "default" {
386386
`, context)
387387
}
388388

389-
func TestAccComputeRegionBackendService_regionBackendServiceConnectionTrackingExample(t *testing.T) {
390-
t.Parallel()
391-
392-
context := map[string]interface{}{
393-
"random_suffix": randString(t, 10),
394-
}
395-
396-
vcrTest(t, resource.TestCase{
397-
PreCheck: func() { testAccPreCheck(t) },
398-
Providers: testAccProviders,
399-
CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t),
400-
Steps: []resource.TestStep{
401-
{
402-
Config: testAccComputeRegionBackendService_regionBackendServiceConnectionTrackingExample(context),
403-
},
404-
{
405-
ResourceName: "google_compute_region_backend_service.default",
406-
ImportState: true,
407-
ImportStateVerify: true,
408-
ImportStateVerifyIgnore: []string{"network", "region"},
409-
},
410-
},
411-
})
412-
}
413-
414-
func testAccComputeRegionBackendService_regionBackendServiceConnectionTrackingExample(context map[string]interface{}) string {
415-
return Nprintf(`
416-
resource "google_compute_region_backend_service" "default" {
417-
name = "tf-test-region-service%{random_suffix}"
418-
region = "us-central1"
419-
health_checks = [google_compute_region_health_check.health_check.id]
420-
connection_draining_timeout_sec = 10
421-
session_affinity = "CLIENT_IP"
422-
protocol = "TCP"
423-
load_balancing_scheme = "EXTERNAL"
424-
connection_tracking_policy {
425-
tracking_mode = "PER_SESSION"
426-
connection_persistence_on_unhealthy_backends = "NEVER_PERSIST"
427-
idle_timeout_sec = 60
428-
}
429-
}
430-
431-
resource "google_compute_region_health_check" "health_check" {
432-
name = "tf-test-rbs-health-check%{random_suffix}"
433-
region = "us-central1"
434-
435-
tcp_health_check {
436-
port = 22
437-
}
438-
}
439-
`, context)
440-
}
441-
442389
func testAccCheckComputeRegionBackendServiceDestroyProducer(t *testing.T) func(s *terraform.State) error {
443390
return func(s *terraform.State) error {
444391
for name, rs := range s.RootModule().Resources {

google-beta/resource_gke_hub_feature_membership_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"testing"
77

8-
dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
8+
"github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
99
gkehub "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/gkehub/beta"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
1111
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"

website/docs/r/compute_region_backend_service.html.markdown

Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -279,39 +279,6 @@ resource "google_compute_subnetwork" "default" {
279279
network = google_compute_network.default.id
280280
}
281281
```
282-
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
283-
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=region_backend_service_connection_tracking&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
284-
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
285-
</a>
286-
</div>
287-
## Example Usage - Region Backend Service Connection Tracking
288-
289-
290-
```hcl
291-
resource "google_compute_region_backend_service" "default" {
292-
name = "region-service"
293-
region = "us-central1"
294-
health_checks = [google_compute_region_health_check.health_check.id]
295-
connection_draining_timeout_sec = 10
296-
session_affinity = "CLIENT_IP"
297-
protocol = "TCP"
298-
load_balancing_scheme = "EXTERNAL"
299-
connection_tracking_policy {
300-
tracking_mode = "PER_SESSION"
301-
connection_persistence_on_unhealthy_backends = "NEVER_PERSIST"
302-
idle_timeout_sec = 60
303-
}
304-
}
305-
306-
resource "google_compute_region_health_check" "health_check" {
307-
name = "rbs-health-check"
308-
region = "us-central1"
309-
310-
tcp_health_check {
311-
port = 22
312-
}
313-
}
314-
```
315282

316283
## Argument Reference
317284

@@ -464,14 +431,7 @@ The following arguments are supported:
464431
(Optional)
465432
Type of session affinity to use. The default is NONE. Session affinity is
466433
not applicable if the protocol is UDP.
467-
Possible values are `NONE`, `CLIENT_IP`, `CLIENT_IP_PORT_PROTO`, `CLIENT_IP_PROTO`, `GENERATED_COOKIE`, `HEADER_FIELD`, `HTTP_COOKIE`, and `CLIENT_IP_NO_DESTINATION`.
468-
469-
* `connection_tracking_policy` -
470-
(Optional)
471-
Connection Tracking configuration for this BackendService.
472-
This is available only for Layer 4 Internal Load Balancing and
473-
Network Load Balancing.
474-
Structure is [documented below](#nested_connection_tracking_policy).
434+
Possible values are `NONE`, `CLIENT_IP`, `CLIENT_IP_PORT_PROTO`, `CLIENT_IP_PROTO`, `GENERATED_COOKIE`, `HEADER_FIELD`, and `HTTP_COOKIE`.
475435

476436
* `timeout_sec` -
477437
(Optional)
@@ -957,43 +917,6 @@ The following arguments are supported:
957917
less than one second are represented with a 0 `seconds` field and a positive
958918
`nanos` field. Must be from 0 to 999,999,999 inclusive.
959919

960-
<a name="nested_connection_tracking_policy"></a>The `connection_tracking_policy` block supports:
961-
962-
* `idle_timeout_sec` -
963-
(Optional)
964-
Specifies how long to keep a Connection Tracking entry while there is
965-
no matching traffic (in seconds).
966-
For L4 ILB the minimum(default) is 10 minutes and maximum is 16 hours.
967-
For NLB the minimum(default) is 60 seconds and the maximum is 16 hours.
968-
969-
* `tracking_mode` -
970-
(Optional)
971-
Specifies the key used for connection tracking. There are two options:
972-
`PER_CONNECTION`: The Connection Tracking is performed as per the
973-
Connection Key (default Hash Method) for the specific protocol.
974-
`PER_SESSION`: The Connection Tracking is performed as per the
975-
configured Session Affinity. It matches the configured Session Affinity.
976-
Default value is `PER_CONNECTION`.
977-
Possible values are `PER_CONNECTION` and `PER_SESSION`.
978-
979-
* `connection_persistence_on_unhealthy_backends` -
980-
(Optional)
981-
Specifies connection persistence when backends are unhealthy.
982-
If set to `DEFAULT_FOR_PROTOCOL`, the existing connections persist on
983-
unhealthy backends only for connection-oriented protocols (TCP and SCTP)
984-
and only if the Tracking Mode is PER_CONNECTION (default tracking mode)
985-
or the Session Affinity is configured for 5-tuple. They do not persist
986-
for UDP.
987-
If set to `NEVER_PERSIST`, after a backend becomes unhealthy, the existing
988-
connections on the unhealthy backend are never persisted on the unhealthy
989-
backend. They are always diverted to newly selected healthy backends
990-
(unless all backends are unhealthy).
991-
If set to `ALWAYS_PERSIST`, existing connections always persist on
992-
unhealthy backends regardless of protocol and session affinity. It is
993-
generally not recommended to use this mode overriding the default.
994-
Default value is `DEFAULT_FOR_PROTOCOL`.
995-
Possible values are `DEFAULT_FOR_PROTOCOL`, `NEVER_PERSIST`, and `ALWAYS_PERSIST`.
996-
997920
<a name="nested_log_config"></a>The `log_config` block supports:
998921

999922
* `enable` -

0 commit comments

Comments
 (0)