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

Network ID as a top level module output? #307

Closed
alexjmoore opened this issue Jul 6, 2021 · 9 comments
Closed

Network ID as a top level module output? #307

alexjmoore opened this issue Jul 6, 2021 · 9 comments

Comments

@alexjmoore
Copy link

It would be nice to get the network ID as a top level output from the module. For example I had to do this to get the ID:

module.network["vpc-test"].network.network.id]

Would be nice to have:

module.network["vpc-test"].network_id]

@bharathkkb
Copy link
Member

Hi @alexjmoore
We could add this but most use cases I have encountered seem to use network_self_link. What is your use case for network.id?

@alexjmoore
Copy link
Author

It's a good point, because I did think it unusual to have to use it. It's in the google_active_directory_domain resource, eg:

resource "google_active_directory_domain" "ad-domain" {
  domain_name       = "ad1.example.com"
  locations         = ["europe-west2"]
  reserved_ip_range = "192.168.255.0/24"
  authorized_networks = [module.network["vpc-test"].network.network.id]
}

It actually confused me quite a bit getting it to work as the docs for that resource aren't super clear what you put there, initially I tried just the network name, then the self_link, in fact even on the gcloud cli the network name doesn't work....I suspect its an inconsistency on the API itself.

Thoughts?

@morgante
Copy link
Contributor

morgante commented Jul 6, 2021

Since usage of the network ID is quite rare and there is a solution here, I'm inclined to think we shouldn't add an additional output.

@alexjmoore
Copy link
Author

Is it worth raising a case against the provider itself to see if it makes sense to revise resource google_active_directory_domain to take the self link you think?

@morgante
Copy link
Contributor

Sure, I think that would be a reasonable request since most resources already accept self-links.

@alexjmoore
Copy link
Author

@morgante it seems the provider folks indicate that id is the preferred field, as per: hashicorp/terraform-provider-google#9546 thoughts?

@morgante
Copy link
Contributor

Hmm, I think we can add this as an output then.

@3sne
Copy link
Contributor

3sne commented Aug 9, 2021

Hi, I have submitted a PR for this issue.

@morgante
Copy link
Contributor

Fixed by #315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants