Hello,
I’m looking for a way to determine the GCP organization name, to be fetched via our terraform module with project name as input.
While inspecting the data block as per docs , it accepts the name of the org.
Do let me know if its possible to get the GCP organization name with GCP project name as input.
https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/project
data "google_project" "project" {}
output "test" {
value = data.google_project.project.org_id
}
This will get you the numeric org ID.
You can also pass that to an org data resource, but the human readable value will likely be there as domain
vs name
; the “name” attribute will be organizations/NNNNNNNNNNN
when NNNNNNNNNNN
is the numeric ID.
data "google_project" "project" {}
data "google_organization" "org" {
organization = data.google_project.project.org_id
}
output "org_id" {
value = data.google_project.project.org_id
}
output "org_name" {
value = data.google_organization.org
}