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

GCP: terraform plan for updating lbs cert/key sets SESSION_AFFINITY to blank string #14770

Closed
genevieve opened this issue May 23, 2017 · 3 comments

Comments

@genevieve
Copy link

genevieve commented May 23, 2017

Creating load balancers then updating those load balancers with new cert/key fails during terraform apply trying to delete the target pool before deleting the forwarding rule bound to it.

Terraform Version

0.9.4 or 0.9.5

Affected Resource(s)

  • google_compute_target_pool
  • google_compute_forwarding_rule

Terraform Configuration Files

resource "google_compute_target_pool" "target-pool" {
  name = "${var.env_id}-concourse"
}

resource "google_compute_forwarding_rule" "ssh-forwarding-rule" {
  name        = "${var.env_id}-concourse-ssh"
  target      = "${google_compute_target_pool.target-pool.self_link}"
  port_range  = "2222"
  ip_protocol = "TCP"
  ip_address  = "${google_compute_address.concourse-address.address}"
}

resource "google_compute_forwarding_rule" "https-forwarding-rule" {
  name        = "${var.env_id}-concourse-https"
  target      = "${google_compute_target_pool.target-pool.self_link}"
  port_range  = "443"
  ip_protocol = "TCP"
  ip_address  = "${google_compute_address.concourse-address.address}"
}

Debug Output

The target_pool resource cannot be deleted because it is already being used by the forwarding rule (resourceInUseByAnotherResource).

Expected Behavior

The terraform apply should have successfully completed updating the load balancers with the new cert/key.

The expected terraform plan for updating load balancers

~ google_compute_firewall.firewall-concourse
    source_ranges.#:          "1" => "0"
    source_ranges.1080289694: "0.0.0.0/0" => ""

Actual Behavior

It failed with resourceInUseByAnotherResource. This has been happening for the past 2-3 days.

The breaking terraform plan to update load balancers

~ google_compute_firewall.firewall-concourse
    source_ranges.#:          "1" => "0"
    source_ranges.1080289694: "0.0.0.0/0" => ""

~ google_compute_forwarding_rule.https-forwarding-rule
    target: "URL/targetPools/g-concourse" => "${google_compute_target_pool.target-pool.self_link}"

~ google_compute_forwarding_rule.ssh-forwarding-rule
    target: "URL/targetPools/g-concourse" => "${google_compute_target_pool.target-pool.self_link}"

-/+ google_compute_target_pool.target-pool
    instances.#:      "0" => "<computed>"
    name:             "g-concourse" => "g-concourse"
    project:          "g" => "<computed>"
    region:           "us-east1" => "<computed>"
    self_link:        "URL/targetPools/g-concourse" => "<computed>"
    session_affinity: "NONE" => "" (forces new resource)

It looks like the session_affinity is being set to a blank string and forcing a new resource

The successful terraform plan to delete load balancers

- google_compute_address.concourse-address

- google_compute_firewall.firewall-concourse

- google_compute_forwarding_rule.https-forwarding-rule

- google_compute_forwarding_rule.ssh-forwarding-rule

- google_compute_target_pool.target-pool

Summary:

If I create the load balancers then update the load balancers, it tries to recreate the target pool resource instead of updating the firewall resource because SESSION_AFFINITY gets set to a blank string.

@genevieve genevieve changed the title AWS/GCP: subsequent terraform apply fails with resourceInUseByAnotherResource AWS/GCP: terraform plan for updating lbs cert/key sets SESSION_AFFINITY to blank string May 23, 2017
@genevieve genevieve changed the title AWS/GCP: terraform plan for updating lbs cert/key sets SESSION_AFFINITY to blank string GCP: terraform plan for updating lbs cert/key sets SESSION_AFFINITY to blank string May 23, 2017
@alexandr-f-boyko
Copy link

Same issue on 0.8.7. Looks like something changed on GCP API side.

@danawillow
Copy link
Contributor

Fixed in #14807

@ghost
Copy link

ghost commented Apr 12, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants