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

terraform apply fails when creating 'google_service_account' with 'project' being set by a google_project resource #16996

Closed
markti opened this issue Jan 15, 2024 · 4 comments
Assignees
Labels
bug forward/review In review; remove label to forward service/iam-serviceaccount

Comments

@markti
Copy link

markti commented Jan 15, 2024

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

Affected Resource(s)

  • google_service_account

Terraform Configuration Files

data "google_billing_account" "main" {
  display_name    = "Default"
  lookup_projects = false
}
resource "google_project" "main" {
  name            = "${var.application_name}-${var.environment_name}"
  project_id      = "${var.application_name}-${var.environment_name}-${random_string.project_id.result}"
  org_id          = var.gcp_organization
  billing_account = data.google_billing_account.main.id
}
resource "google_service_account" "cluster" {
  project      = google_project.main.id
  account_id   = "sa-gke-${var.application_name}-${var.environment_name}-${random_string.project_id.result}"
  display_name = "sa-gke-${var.application_name}-${var.environment_name}-${random_string.project_id.result}"
}

Debug Output

Panic Output

<p><b>404.</b> <ins>That’s an error.</ins> │ <p>The requested URL <code>/v1/projects/projects/MY_PROJECT_ID/serviceAccounts?alt=json&amp;prettyPrint=false</code> was not found on this server. <ins>That’s all we know.</ins>

Expected Behavior

It should create a service account in the specified project.

Actual Behavior

It fails with a strange 404 error on a seemingly correct URL path.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@markti markti added the bug label Jan 15, 2024
@github-actions github-actions bot added forward/review In review; remove label to forward service/iam-serviceaccount labels Jan 15, 2024
@markti
Copy link
Author

markti commented Jan 15, 2024

oof... needed to use the 'project_id' attribute.

google_project.main.project_id

please forgive me... 😃

@edwardmedia edwardmedia self-assigned this Jan 15, 2024
@edwardmedia
Copy link
Contributor

@markti no worries. Should we close this issue now?

@edwardmedia
Copy link
Contributor

edwardmedia commented Jan 24, 2024

@markti closing now assume the answer is okay

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug forward/review In review; remove label to forward service/iam-serviceaccount
Projects
None yet
Development

No branches or pull requests

2 participants