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

fix!: Change default balancing_mode to CONNECTION for backends #148

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
64 changes: 64 additions & 0 deletions docs/upgrading_to_lb_internal_v7.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Upgrading to v7.0 (from v6.x)

The v7.0 release is a backwards incompatible release.

# balancing_mode for backends

The newest version of `google_compute_region_backend_service` requires a `balancing_mode` be set for backends. Therefore a default `balancing_mode` of `CONNECTION` is used in the dynamic `backend` block in v7.0 of this module. The full list of balancing modes is available in the [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_backend_service#balancing_mode).

## Upgrade Guidance

In this example, `balancing_mode` is *not* provided in the `backends` block. Therefore, it will default to `CONNECTION`.

```hcl
module "gce_ilb" {
source = "GoogleCloudPlatform/lb-internal/google"
version = ">= 4.4.0"
project = var.project_id
region = var.region
name = "tf-ilb"
network = "testnetwork"
subnetwork = "testsubnet"
ports = ["xxxx"]
health_check = local.health_check
source_tags = ["xxxxxx"]
target_tags = ["xxxxxx"]
backends = [
for x in google_compute_instance_group.test_ig[*] : {
group = x.id
description = ""
failover = false
}
]
create_backend_firewall = "true"
create_health_check_firewall = "true"
}
```

This is an example where the `balancing_mode` is explicitly provided:

```hcl
module "gce_ilb" {
source = "GoogleCloudPlatform/lb-internal/google"
version = ">= 4.4.0"
project = var.project_id
region = var.region
name = "tf-ilb"
network = "testnetwork"
subnetwork = "testsubnet"
ports = ["xxxx"]
health_check = local.health_check
source_tags = ["xxxxxx"]
target_tags = ["xxxxxx"]
backends = [
for x in google_compute_instance_group.test_ig[*] : {
group = x.id
description = ""
failover = false
balancing_mode = "CONNECTION"
}
]
create_backend_firewall = "true"
create_health_check_firewall = "true"
}
```
8 changes: 5 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ resource "google_compute_region_backend_service" "default" {
# Do not try to add timeout_sec, as it is has no impact. See https://github.com/terraform-google-modules/terraform-google-lb-internal/issues/53#issuecomment-893427675
connection_draining_timeout_sec = var.connection_draining_timeout_sec
session_affinity = var.session_affinity

dynamic "backend" {
for_each = var.backends
content {
group = lookup(backend.value, "group", null)
description = lookup(backend.value, "description", null)
failover = lookup(backend.value, "failover", null)
group = lookup(backend.value, "group", null)
description = lookup(backend.value, "description", null)
failover = lookup(backend.value, "failover", null)
balancing_mode = lookup(backend.value, "balancing_mode", "CONNECTION")
}
}
health_checks = concat(google_compute_health_check.tcp[*].self_link, google_compute_health_check.http[*].self_link, google_compute_health_check.https[*].self_link)
Expand Down