magic-modules icon indicating copy to clipboard operation
magic-modules copied to clipboard

Made base transport layer force ipv4 usage if ipv6 is not supported

Open melinath opened this issue 2 months ago • 13 comments

Fixes https://github.com/hashicorp/terraform-provider-google/issues/6782

Workaround for https://github.com/golang/go/issues/25321

Note that while I was able to reproduce the Go issue, I was not able to reproduce the TF issue - there seems to be some amount of randomness in terms of when it presents. However, this seems to be the best option for working around the issue.

This PR also removes a lot of complexity that was previously implicitly part of our transport setup via transport.NewHTTPClient and that was mostly unused. (I traced through the code to boil it down to the ~10 or so~ 6 lines we were actually using.)

yaqs/47302089738551296

Release Note Template for Downstream PRs (will be copied)

provider: Forced HTTP requests to use ipv4 on systems with ipv6 disabled, such as Cloud Shell.

melinath avatar Apr 18 '24 23:04 melinath

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 1 file changed, 47 insertions(+), 5 deletions(-)) google-beta provider: Diff ( 1 file changed, 47 insertions(+), 5 deletions(-))

modular-magician avatar Apr 18 '24 23:04 modular-magician

Tests analytics

Total tests: 3606 Passed tests: 3242 Skipped tests: 364 Affected tests: 0

Click here to see the affected service packages
all service packages are affected

$\textcolor{green}{\textsf{All tests passed!}}$ View the build log

modular-magician avatar Apr 19 '24 00:04 modular-magician

Some real test runs, in case VCR bypasses this change: https://hashicorp.teamcity.com/buildConfiguration/TerraformProviders_GoogleCloud_GOOGLE_MMUPSTREAMTESTS_GOOGLE_PACKAGE_PUBSUB/135875?hideTestsFromDependencies=false&hideProblemsFromDependencies=false&expandBuildChangesSection=true

melinath avatar Apr 19 '24 15:04 melinath

Adding @ScottSuarez as a mandatory reviewer- we should ensure that MTLS is not broken as a result of this change.

rileykarson avatar Apr 19 '24 18:04 rileykarson

Do we want a provider-wide changelog note?

c2thorn avatar Apr 19 '24 20:04 c2thorn

Do we want a provider-wide changelog note?

added

melinath avatar Apr 19 '24 20:04 melinath

Do we want a provider-wide changelog note?

added

We are expecting some user-facing impact right? Specifically user's facing https://github.com/hashicorp/terraform-provider-google/issues/6782 will now have their ipv4 settings honored?

c2thorn avatar Apr 19 '24 21:04 c2thorn

Do we want a provider-wide changelog note?

added

We are expecting some user-facing impact right? Specifically user's facing hashicorp/terraform-provider-google#6782 will now have their ipv4 settings honored?

🤦 yep. yep. we sure are. fixed.

melinath avatar Apr 19 '24 21:04 melinath

Unfortunately the "just override the transport's dialcontext" approach is not feasible because the base transport is wrapped a few times and two of them use private fields to store the wrapped RoundTripper.

melinath avatar Apr 26 '24 16:04 melinath

yaqs/5034757202074664960

melinath avatar Apr 26 '24 17:04 melinath

I'm going to attempt to get this change made in google-api-go-client

melinath avatar Apr 26 '24 20:04 melinath

Opened https://github.com/googleapis/google-api-go-client/pull/2549

melinath avatar Apr 26 '24 20:04 melinath