diff --git a/go.mod b/go.mod index 2a3fa762e6a5..9bc3f2c982fd 100644 --- a/go.mod +++ b/go.mod @@ -17,8 +17,8 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 github.com/hashicorp/go-azure-helpers v0.71.0 - github.com/hashicorp/go-azure-sdk/resource-manager v0.20241118.1115603 - github.com/hashicorp/go-azure-sdk/sdk v0.20241118.1115603 + github.com/hashicorp/go-azure-sdk/resource-manager v0.20241128.1112539 + github.com/hashicorp/go-azure-sdk/sdk v0.20241128.1112539 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 diff --git a/go.sum b/go.sum index f95b0d5cc376..6a72b63d8ca4 100644 --- a/go.sum +++ b/go.sum @@ -94,10 +94,10 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-azure-helpers v0.71.0 h1:ra3aIRzg01g6MLKQ+yABcb6WJtrqRUDDgyuPLmyZ9lY= github.com/hashicorp/go-azure-helpers v0.71.0/go.mod h1:BmbF4JDYXK5sEmFeU5hcn8Br21uElcqLfdQxjatwQKw= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20241118.1115603 h1:YmPg9BwqWZdrNtaezgwt3rRLJipDrAEFQw/EJ54yFVs= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20241118.1115603/go.mod h1:7mzEbFWcjAAO2xomo9oB8B3HbjLRIaS2gMulSfuOmvY= -github.com/hashicorp/go-azure-sdk/sdk v0.20241118.1115603 h1:7Nmi7O/vl4aTSGFARHb1QXxRNI1GlZ6wKD8046/bGBo= -github.com/hashicorp/go-azure-sdk/sdk v0.20241118.1115603/go.mod h1:dMKF6bXrgGmy1d3pLzkmBpG2JIHgSAV2/OMSCEgyMwE= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20241128.1112539 h1:rHh2P5qcPObzpfAFafIjle3CowejFAHTfBJAHDkuSGk= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20241128.1112539/go.mod h1:oQAUu+aCHPCM0CDfsQTBnEkfUZ+sLhEW8Ssip9AeCLc= +github.com/hashicorp/go-azure-sdk/sdk v0.20241128.1112539 h1:6Ps2V/DBwBxWEjSx01fM+PqG+uIavHWvxmM2vb1N2Ok= +github.com/hashicorp/go-azure-sdk/sdk v0.20241128.1112539/go.mod h1:oI5R0fTbBx3K/sJBK5R/OlEy8ozdQjvctxVU9v3EDkc= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go index 52de494374ae..d77e8afaf4d9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go @@ -471,8 +471,13 @@ func (c *Client) Execute(ctx context.Context, req *Request) (*Response, error) { // Check for failed connections etc and decide if retries are appropriate if r == nil { if req.IsIdempotent() { - return extendedRetryPolicy(r, err) + if !isResourceManagerHost(req) { + return extendedRetryPolicy(r, err) + } + + return retryablehttp.DefaultRetryPolicy(ctx, r, err) } + return false, fmt.Errorf("HTTP response was nil; connection may have been reset") } @@ -754,6 +759,7 @@ func containsStatusCode(expected []int, actual int) bool { // extendedRetryPolicy extends the defaultRetryPolicy implementation in go-retryablehhtp with // additional error conditions that should not be retried indefinitely +// TODO - This should be removed as part of 5.0 release of AzureRM, and the base layer returned to the `retryablehttp.DefaultRetryPolicy` for all requests. func extendedRetryPolicy(resp *http.Response, err error) (bool, error) { // A regular expression to match the error returned by net/http when the // configured number of redirects is exhausted. This error isn't typed @@ -840,3 +846,22 @@ func extendedRetryPolicy(resp *http.Response, err error) (bool, error) { return false, nil } + +// exclude Resource Manager calls from the network failure retry avoidance to help users on unreliable networks +// This code path should be removed when the Data Plane separation work is completed and 5.0 ships. +func isResourceManagerHost(req *Request) bool { + knownResourceManagerHosts := []string{ + "management.azure.com", + "management.chinacloudapi.cn", + "management.usgovcloudapi.net", + } + if url := req.Request.URL; url != nil { + for _, host := range knownResourceManagerHosts { + if strings.Contains(url.Host, host) { + return true + } + } + } + + return false +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 948053c92d07..6ef0f775e92f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -148,8 +148,8 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/tags github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk/resource-manager v0.20241118.1115603 -## explicit; go 1.21 +# github.com/hashicorp/go-azure-sdk/resource-manager v0.20241128.1112539 +## explicit; go 1.22 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants @@ -1158,8 +1158,8 @@ github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplands github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances -# github.com/hashicorp/go-azure-sdk/sdk v0.20241118.1115603 -## explicit; go 1.21 +# github.com/hashicorp/go-azure-sdk/sdk v0.20241128.1112539 +## explicit; go 1.22 github.com/hashicorp/go-azure-sdk/sdk/auth github.com/hashicorp/go-azure-sdk/sdk/auth/autorest github.com/hashicorp/go-azure-sdk/sdk/claims