-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Deleting activated services on a project fails #1292
Comments
Also running into this with usage bucket export:
|
We should add a field Excerpt from the
|
Thanks @rosbo but I'm not sure that actually solves it since I'm already using |
Ooops. I read too quickly and mistakenly read "google_project_services" for the resource you are using because the name of your resource is "project_services"... I believe the problem you are experiencing is caused by the fact that Usually, that relationship is created automatically when interpolating the In your case, you will need to add an explicit dependency: resource "google_project_service" "project_services" {
...
depends_on = ["google_project.folder"]
} Let me know if that fixes your problem. |
I'm curious why the dependency isn't being created automatically? Do you know why the transitivity isn't working when it passes through the locals variable first? The dependency did work when the project was created since I didn't get any errors about trying to activate services on a non-existent project. |
I'm guessing it's because I imagine the graph looks different for a complete destroy, IIRC that would read from state and plan to destroy everything, meaning it wouldn't consider the dependency on local et. al. I could be wrong though... If I'm write, that would mean that project and service don't get a dependency and are deleted in parallel (or possibly deleted in parallel, depending on the number of resources). Which leads to this issue. In that case, the Does changing resource "google_project" "folder" {
count = "${var.folder_id != false ? 1 : 0}"
name = "${var.name}"
project_id = "${local.final_project_id}"
folder_id = "${var.folder_id}"
billing_account = "${var.billing_account}"
}
resource "google_project_service" "project_services" {
count = "${length(var.activate_apis)}"
project = "${element(coalescelist(google_project.folder.*.project_id, google_project.org.*.project_id), 0)}"
service = "${element(var.activate_apis,count.index)}"
} |
@danawillow Is this related to #1538 ? |
Nope- #1538 is specific to the release that occurred last week. |
@morgante is this still an issue? Can I close this out? If this is still an issue, I think it's at least an upstream issue with Terraform--I'm not sure there's much the provider can do, unfortunately, except maybe consider the service deleted if the project can't be found. |
@paddycarver Yes I still encounter this regularly.
That would help a lot. I regularly have to run |
When reading or deleting the google_project_service resource, first retrieve the project. If it's not found, or if it's pending deletion, remove the service, as it's functionally disabled. Also, add a test to confirm the behaviour. This should resolve #1292.
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 👉 hashibot-feedback@hashicorp.com. Thanks! |
I'm trying to delete a module which both created a project and activated some services on that project, but it fails because the project gets created first.
Terraform Version
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Debug Output
Ping me privately if this is needed.
Expected Behavior
The services resource is "deleted" before the project (not that it actually needs to do something).
Actual Behavior
The service enters a zombie state where it constantly tries to get removed even though the project isn't even active any more.
Whenever I try to apply afterwards it's unable to fetch the state:
The text was updated successfully, but these errors were encountered: