-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
google_compute_instance: ephemeral ip address and splat syntax #3089
Comments
Probably you need |
I believe this is a variant of hashicorp/terraform#17048. If so, it could be fixed with a computed convenience field or by 0.12. |
I have tried nat_ip
But it gives me the same error
|
If you wanted an ephemeral IP address, you should have used an empty resource "google_compute_instance" "gce-test" {
[...]
network_interface {
subnetwork = "default"
access_config {}
}
[...]
} Then, for the output: output "gce_public_ip" {
value = "${google_compute_instance.gce-test.network_interface.0.access_config.0.nat_ip}"
} |
It will give an error if resource does not exist.
With the following output
For e.g.
and that's the root of the issue |
Okay. According to hashicorp/terraform#16726, this output should work: output "gce_public_ip" {
value = "${element(concat(google_compute_instance.gce-test.*.network_interface.0.access_config.0.nat_ip, list("")), 0)}"
} I have just tested it and it seems to work. |
Yes, works fine. Thanks. But the syntax looks weird |
Has this been fixed in 0.12? |
Signed-off-by: Modular Magician <magic-modules@google.com>
In newer versions (e.g. 0.13.5) syntax is changed
For those who interested following won't show any warning:
|
@tillias Also, |
I have no problem with the public ip output as per documentation. I use a blank access_config {} block, then in outputs.tf
|
In Terraform v1.2.4 worked
and
|
Is this still an issue? |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
And the output.tf looks like
Debug Output
Panic Output
Expected Behavior
The output should be empty as with google_compute_address resource
Actual Behavior
terraform apply
I have tried a different combinations
but without success. If I replace ephemeral ip address with a static one - everything works fine.
Steps to Reproduce
Important Factoids
References
b/308755570
The text was updated successfully, but these errors were encountered: