-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
- Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
- If an issue is assigned to the
modular-magicianuser, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot, a community member has claimed the issue already.
Terraform Version
tf version
Terraform v0.12.28
+ provider.google v3.29.0
+ provider.google-beta v3.29.0
Affected Resource(s)
All resources, not specific to any one.
Terraform Configuration Files
While this happens intermittently and it's not specific to this config, it seems to happen with longer Terraform runs. You may need to apply / destroy 1-2 times before seeing this issue.
Debug Output
I see this output sporadically, and not on the same API call. Note the DST IP is an IPv6 address, but Cloud Shell does not enable IPv6 in the OS:
Link to gist
Console output when issue occurs (Note the IPv6 address is being used):
Error: Error when reading or editing Project Service [project-id]/trafficdirector.googleapis.com: Get "https://cloudresourcemanager.googleapis.com/v1/projects/[project-id]?alt=json&prettyPrint=false": dial tcp [2404:6800:4003:c00::5f]:443: connect: cannot assign requested address
Error: Error retrieving available container cluster versions: Get "https://container.googleapis.com/v1beta1/projects/[project-id]/locations/asia-east1-c/serverConfig?alt=json&prettyPrint=false": dial tcp [2404:6800:4003:c04::5f]:443: connect: cannot assign requested address
Error: Error when reading or editing Project Service [project-id]/trafficdirector.googleapis.com: Get "https://cloudresourcemanager.googleapis.com/v1/projects/[project-id]?alt=json&prettyPrint=false": dial tcp [2404:6800:4003:c03::5f]:443: connect: cannot assign requested address
Expected Behavior
Terraform / Google provider should respect the OS network settings and use IPv4 addresses to call out to *.googleapis.com.
Actual Behavior
tf apply / tf destroy does not always successfully complete, and will return the errors above.
Steps to Reproduce
- Open Google Cloud Shell (no IPv6 stack)
- Run tf apply or tf destroy on the linked config
- Most times it will succeed, but about every second attempt it report the above errors
Note, if I statically configure /etc/hosts to resolve to a specific IPv4 address - say 199.36.153.8, the above errors never occur.
Important Factoids
Authenticating using application default credentials, built into Cloud Shell.
Confirm IPv6 is not enabled on the OS:
myusername@cloudshell:~$ sudo sysctl -n net.ipv6.conf.all.disable_ipv6 && sysctl -n net.ipv6.conf.default.disable_ipv6
1
1
References
Similar issue 1 (with Go)
Similar issue 2
Workaround solution
- b/160321706