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

google_service_account: Service account gets created, but apply run fails with "Error reading service account after creation" #6758

Open
neurolabs opened this issue Jul 8, 2020 · 1 comment

Comments

@neurolabs
Copy link

neurolabs commented Jul 8, 2020

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 -v
Terraform v0.12.28
+ provider.google v3.28.0
...

Affected Resource(s)

  • google_service_account

Terraform Configuration Files

resource "google_service_account" "foobar" {
  project      = google_project.main.project_id
  account_id   = "foobar"
  display_name = "Foo Bar"

  provisioner "local-exec" {
    # Creation of service accounts is eventually consistent:
    # https://www.terraform.io/docs/providers/google/r/google_service_account.html
    command = "sleep 10"
  }
}

Debug Output

None given

Panic Output

Expected Behavior

The account is created successfully and google_service_account resource finishes successfully.

Actual Behavior

The account is created successfully (eventually) and google_service_account resource fails.

Error: Error reading service account after creation: googleapi: Error 404: Service account projects/main-3e/serviceAccounts/foobar@main-3e.iam.gserviceaccount.com does not exist., notFound
  on project-api.tf line 41, in resource "google_service_account" "foobar":
  41: resource "google_service_account" "foobar" {

Steps to Reproduce

  1. terraform apply

Important Factoids

References

@ghost ghost added bug labels Jul 8, 2020
@c2thorn
Copy link
Collaborator

c2thorn commented Jul 10, 2020

Hey @neurolabs sorry to hear you are still getting this error. The PR added a retry timeout that is adjustable via the create timeout. It's possible that your service account creation is taking longer than the default timeout of 5 minutes to become eventually consistent.

I'm unable to get a failure on apply in my repro, do you have debug logs for me to look through?

modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Nov 1, 2022
…pgrade to `4.42.0` (hashicorp#6758)

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit that referenced this issue Nov 1, 2022
…pgrade to `4.42.0` (#6758) (#12922)

Signed-off-by: Modular Magician <magic-modules@google.com>

Signed-off-by: Modular Magician <magic-modules@google.com>
shuyama1 pushed a commit that referenced this issue Nov 1, 2022
…pgrade to `4.42.0` (#6758) (#12922)

Signed-off-by: Modular Magician <magic-modules@google.com>

Signed-off-by: Modular Magician <magic-modules@google.com>
@github-actions github-actions bot added service/iam-serviceaccount forward/review In review; remove label to forward labels Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants