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

NAT gateway with nat_ip_allocate_option=AUTO, no ip address output #37

Open
dddomin3 opened this issue Aug 19, 2020 · 4 comments
Open
Labels
enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work upstream Work required on Terraform core or provider

Comments

@dddomin3
Copy link

Issue summary:
When creating a nat gateway with nat_ip_allocate_option=AUTO_ONLY, the nat gateway terraform module does not output the ip addresses that were assigned to the nat gateway. Deriving the ip address that is assigned to the nat gateway would involve a data resource, and doesn’t feel like best practice
I would expect the ip address to be outputted in the nat_ips array. The documentation suggests that this field is ignored if AUTO_ONLY is set, but it’s ambiguous if this extends to the outputted data.
I’d either expect there to be a different output for ips outright, or for the nat_ips array to be populated regardless of the nat_ip_allocate_option value

Steps to reproduce:
Create a NAT gateway with terraform. Set "nat_ip_allocate_option" = "AUTO_ONLY". Try to get IP address out of "nat_ips" = [] and see that it's blank.

@morgante morgante added enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work labels Aug 24, 2020
@morgante
Copy link
Contributor

Your assessment is correct, it looks like the nat_ips only passed back the input IPs (if any).

How are you looking up the IPs using a data source?

@dddomin3
Copy link
Author

Oh I just build the nat gateway resource, and use the auto-gened name, and pull it up that way.

data "google_compute_address" "my_address" {
  name = "foobar"
}

Not a elegant solution, sadly... I know ip labels are supported in the beta provider, if you're looking for guidance for a solution, perhaps leveraging those could work? I'm just speculating, never looked into the provider code directly so definitely take it with a grain of salt.

@morgante
Copy link
Contributor

Got it. I think the most elegant solution would be adding it to the provider (please open an issue here for that).

As an interim solution I'd be happy to review a PR which includes this data source and merges it into the nat IP output.

@imrannayer
Copy link
Collaborator

Provider support needed. hashicorp/terraform-provider-google#7469

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work upstream Work required on Terraform core or provider
Projects
None yet
Development

No branches or pull requests

3 participants