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

fix: Using project_id output is not forcing to wait for the project creation #601

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/fabric-project/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

output "project_id" {
description = "Project id (depends on services)."
value = google_project.project.project_id
value = trimprefix(google_project.project.id, "projects/")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't depends_on = [google_project. project] work?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure which depends_on you're asking:

  1. if you're asking about depends_on here in output then no, changing
  depends_on  = [google_project_service.project_services]

to

  depends_on  = [google_project.project]

does not work. Terraform ignores this explicit dependency when it has the output value available immediately. This is especially the case when output value comes from input attribute.

  1. If you're asking whether explicit depends on module.project works e.g. in a datasource that is using this output, then yes, it's working. But please see my comment in main thread.
data "google_storage_project_service_account" "gcs_account" {
  project = module.project.project_id
  depends_on = [module.project]
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I assumed depends_on may block on google_project.project since some of the attribs are computed.

depends_on = [google_project_service.project_services]
}

Expand Down