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

Can't delete an instance group that's in use by a backend service #1853

Closed
danawillow opened this issue Aug 8, 2018 · 2 comments
Closed
Assignees
Labels

Comments

@danawillow
Copy link
Contributor

danawillow commented Aug 8, 2018

Terraform Version

Terraform v0.11.7
provider.google (unversioned)

Affected Resource(s)

  • google_compute_instance_group
  • google_compute_backend_service
    (probably also google_compute_region_backend_service)

Terraform Configuration Files

resource "google_compute_instance" "ig_instance" {
  name           = "b-112171976"
  machine_type   = "n1-standard-1"
  zone           = "us-central1-c"

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-9"
    }
  }

  network_interface {
    network = "default"
  }
}

resource "google_compute_instance_group" "instance_group" {
  name      = "b-112171976"
  zone      = "us-central1-c"
  instances = ["${google_compute_instance.ig_instance.self_link}"]

  named_port {
    name = "https"
    port = "8443"
  }
}

resource "google_compute_backend_service" "default_backend" {
  name      = "b-112171976"
  port_name = "https"
  protocol  = "HTTPS"

  backend {
    group = "${google_compute_instance_group.instance_group.self_link}"
  }

  health_checks = [
    "${google_compute_https_health_check.healthcheck.self_link}",
  ]
}

resource "google_compute_https_health_check" "healthcheck" {
  name         = "b-112171976"
  request_path = "/health_check"
}

Debug Output

https://gist.github.com/danawillow/6962cbf60fdd78691d99fd610e5dbaf5

Panic Output

N/A

Expected Behavior

The instance group was deleted

Actual Behavior

google_compute_instance_group.instance_group: Error deleting InstanceGroup: googleapi: Error 400: The instance_group resource 'projects/graphite-test-danahoffman-tf/zones/us-central1-c/instanceGroups/b-112171976' is already being used by 'projects/graphite-test-danahoffman-tf/global/backendServices/b-112171976', resourceInUseByAnotherResource

Steps to Reproduce

  1. terraform apply
  2. Change the name of the instance group
  3. terraform apply

Important Factoids

N/A

References

N/A

I think we probably want to handle this in a similar way to how we detach disks from instances before deleting them.

@Chupaka
Copy link
Contributor

Chupaka commented Aug 9, 2018

I thought, renaming instance group should be done via

  lifecycle {
    create_before_destroy = true
  }

That's what I actually did a day ago 🤣

@ghost
Copy link

ghost commented Jan 10, 2019

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 Jan 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants