From da00dc3836bbcea7267bf31d43b4ede270833dde Mon Sep 17 00:00:00 2001 From: Tom Bamford Date: Tue, 28 Nov 2023 18:52:06 +0000 Subject: [PATCH] bugfix: resolve issue with no-deadline context when listing RPs --- internal/clients/builder.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/clients/builder.go b/internal/clients/builder.go index 5cf35020fa58..d336b0a03f0e 100644 --- a/internal/clients/builder.go +++ b/internal/clients/builder.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "log" + "time" "github.com/hashicorp/go-azure-helpers/authentication" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" @@ -167,8 +168,11 @@ func Build(ctx context.Context, builder ClientBuilder) (*Client, error) { if features.EnhancedValidationEnabled() { subscriptionId := commonids.NewSubscriptionID(client.Account.SubscriptionId) - location.CacheSupportedLocations(ctx, *resourceManagerEndpoint) - if err := resourceproviders.CacheSupportedProviders(ctx, client.Resource.ResourceProvidersClient, subscriptionId); err != nil { + ctx2, cancel := context.WithTimeout(ctx, 10*time.Minute) + defer cancel() + + location.CacheSupportedLocations(ctx2, *resourceManagerEndpoint) + if err := resourceproviders.CacheSupportedProviders(ctx2, client.Resource.ResourceProvidersClient, subscriptionId); err != nil { log.Printf("[DEBUG] error retrieving providers: %s. Enhanced validation will be unavailable", err) } }