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

Missing API creates inconsistent state around billing account attachment #3457

Closed
andor44 opened this issue Apr 18, 2019 · 3 comments
Closed
Labels

Comments

@andor44
Copy link

andor44 commented Apr 18, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • If an issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to "hashibot", a community member has claimed the issue already.

Terraform Version

Terraform v0.11.13
+ provider.google v2.4.0
+ provider.google-beta v2.4.0

Affected Resource(s)

  • google_project

Terraform Configuration Files

resource "google_project" "foo_project" {
  name                = "foo"
  project_id          = "foo"
  org_id              = "${var.organization_id}"
  billing_account     = "${var.billing_account_id}"
  auto_create_network = false
}

Debug Output

Can provide if needed

Panic Output

No panic

Expected Behavior

If no billing account is attached to the project a re-plan would try to modify it.

Actual Behavior

I had Cloud Resource Manager API enabled so I could create the project, but not Cloud Billing API so the billing account could not be attached. I received the following error:

* google_project.foo_project: Error setting billing account "xxx-xxx-xx" for project "projects/foo-project": googleapi: Error 403: Cloud Billing API has not been used in project [redacted] before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudbilling.googleapis.com/overview?project=[redacted] then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry., accessNotConfigured

After enabling the above API running plan again shows 0 pending changes, and the project has no billing account attached.

Steps to Reproduce

  1. Create a "management" project. Enable Cloud Resource Manager API in it.
  2. Create a service account in the management project, give it permissions to create projects and to attach billing accounts.
  3. Try to create a project with above service account with a specific billing account
  4. Project will be created, billing account won't be attached.
  5. Enable Cloud Billing API on management project.
  6. Run terraform plan, observe no changes planned.
@ghost ghost added the bug label Apr 18, 2019
@andor44
Copy link
Author

andor44 commented Apr 18, 2019

I was too quick on the trigger here: the billing account actually is being changed properly. I had tried to incorrectly use -target on my project which was causing no changes to be planned.

@andor44 andor44 closed this as completed Apr 18, 2019
@gokeefe
Copy link

gokeefe commented May 2, 2019

Thank you for this. I was experiencing a similar issue and thought the error was indicating that the billing_account couldn't be set because the cloudbilling api was not enabled yet, but now I realize it's because cloudbilling wasn't enabled on my 'management' project.

@ghost
Copy link

ghost commented May 19, 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 May 19, 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

2 participants