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

session affinity no longer set on backend services #348

Closed
thecodeassassin opened this issue Aug 22, 2017 · 5 comments · Fixed by #364
Closed

session affinity no longer set on backend services #348

thecodeassassin opened this issue Aug 22, 2017 · 5 comments · Fixed by #364
Assignees
Labels
forward/review In review; remove label to forward service/compute-l7-load-balancer

Comments

@thecodeassassin
Copy link

Terraform Version

v0.10.2

Affected Resource(s)

google_compute_backend_service

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

esource "google_compute_backend_service" "legacy" {

    name = "legacy-backend-${var.environment}"
    description = "Legacy backend service"
    port_name = "http"
    protocol = "HTTP"
    timeout_sec = 120
    session_affinity = "GENERATED_COOKIE"

    depends_on = ["google_compute_instance_group_manager.legacy"]

    backend {
        group = "${google_compute_instance_group_manager.legacy.instance_group}"
    }

    backend {
        group = "${google_compute_instance_group_manager.legacy-fallback.instance_group}"
    }

    health_checks = ["${google_compute_http_health_check.legacy.self_link}"]
}

Debug Output

https://gist.github.com/thecodeassassin/ebf4df4769fe38d6febf1529e014b2ee

Expected Behavior

Should create a backend service that has the session affinity set.

Actual Behavior

What actually happened?

Steps to Reproduce

  1. terraform apply

Important Factoids

I think it broke after upgrading from 0.9.x to 0.10.x.

@thecodeassassin
Copy link
Author

thecodeassassin commented Aug 22, 2017

It seems to be a UI problem on Google Cloud's side. issue can be closed i guess.

@thecodeassassin
Copy link
Author

thecodeassassin commented Aug 23, 2017

I was wrong, it seems that it's not setting the session affinity correctly when updating.

  ~ google_compute_backend_service.legacy
      backend.#:                                 "1" => "2"
      backend.1795308435.balancing_mode:         "UTILIZATION" => "UTILIZATION"
      backend.1795308435.capacity_scaler:        "1" => "1"
      backend.1795308435.description:            "" => ""
      backend.1795308435.group:                  "https://www.googleapis.com/compute/v1/projects/REDACTED/zones/europe-west1-d/instanceGroups/legacy-group-manager-pele" => "https://www.googleapis.com/compute/v1/projects/REDACTED/zones/europe-west1-d/instanceGroups/legacy-group-manager-pele"
      backend.1795308435.max_rate:               "0" => "0"
      backend.1795308435.max_rate_per_instance:  "0" => "0"
      backend.1795308435.max_utilization:        "0.8" => "0.8"
      backend.~3824898581.balancing_mode:        "" => "UTILIZATION"
      backend.~3824898581.capacity_scaler:       "" => "1"
      backend.~3824898581.description:           "" => ""
      backend.~3824898581.group:                 "" => "${google_compute_instance_group_manager.legacy-fallback.instance_group}"
      backend.~3824898581.max_rate:              "" => ""
      backend.~3824898581.max_rate_per_instance: "" => ""
      backend.~3824898581.max_utilization:       "" => "0.8"

@selmanj selmanj self-assigned this Aug 24, 2017
@selmanj
Copy link
Contributor

selmanj commented Aug 25, 2017

Was able to reproduce. Whenever a backend_service is updated, session_affinity is reset to NONE (and a subsequent terraform apply notices this and corrects it).

A quick glance at the code seems to suggest the problem is that the update code is written to only set options that have changed, which then results in session_affinity having a default value.

@selmanj
Copy link
Contributor

selmanj commented Aug 26, 2017

While attempting to fix this, I uncovered an inconsistency with how connection draining default values are set in the GCP API. Filed a bug upstream.

@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
@github-actions github-actions bot added forward/review In review; remove label to forward service/compute-l7-load-balancer labels Jan 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
forward/review In review; remove label to forward service/compute-l7-load-balancer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants