# Fetch GCP Organization value via terraform data block

**URL:** <https://discuss.hashicorp.com/t/fetch-gcp-organization-value-via-terraform-data-block/68361>\
**Category:** Google\
**Created:** [July 4, 2024, 1:48pm UTC](https://discuss.hashicorp.com/t/fetch-gcp-organization-value-via-terraform-data-block/68361 "2024-07-04T13:48:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SanthoshYalamuri](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/santhoshyalamuri/32/37791_2.png) [@SanthoshYalamuri](https://discuss.hashicorp.com/u/SanthoshYalamuri)\
**Post date:** [July 4, 2024, 1:48pm UTC](https://discuss.hashicorp.com/t/fetch-gcp-organization-value-via-terraform-data-block/68361/1 "2024-07-04T13:48:10Z")

</div>

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](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/organization) , 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.

---

<div class="post-metadata">

**Author:** ![wyardley](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/wyardley/32/21845_2.png) [@wyardley](https://discuss.hashicorp.com/u/wyardley)\
**Post date:** [September 29, 2024, 6:27am UTC](https://discuss.hashicorp.com/t/fetch-gcp-organization-value-via-terraform-data-block/68361/2 "2024-09-29T06:27:41Z")

</div>

[https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/project](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/project)

```auto
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.

```auto
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
}

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/hashicorp/original/1X/79bf76adfd92a75631996933098f9ce29d37abf3.svg) [@system](https://discuss.hashicorp.com/u/system)\
**Post date:** [March 28, 2025, 6:27am UTC](https://discuss.hashicorp.com/t/fetch-gcp-organization-value-via-terraform-data-block/68361/3 "2025-03-28T06:27:54Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
