Skip to content
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

bugfix: resolve issue with no-deadline context when listing RPs #24056

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions internal/clients/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"fmt"
"log"
"time"

"github.com/hashicorp/go-azure-helpers/authentication"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
Expand Down Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an aside: we should probably think about surfacing the available Locations on the Environment, so that we don't need to hit this endpoint twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, will have a think about it 👍

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)
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/docs/guides/azure_cli.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ We recommend using either a Service Principal or Managed Service Identity when r

## Logging into the Azure CLI

~> **Note**: If you're using the **China**, **German** or **Government** Azure Clouds - you'll need to first configure the Azure CLI to work with that Cloud. You can do this by running:
~> **Note**: If you're using the **China** or **Government** Azure Clouds - you'll need to first configure the Azure CLI to work with that Cloud. You can do this by running:

```shell
az cloud set --name AzureChinaCloud|AzureGermanCloud|AzureUSGovernment
az cloud set --name AzureChinaCloud|AzureUSGovernment
```

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Once logged in as the Service Principal - we should be able to list the VM sizes
az vm list-sizes --location westus
```

~> **Note**: If you're using the **China**, **German** or **Government** Azure Clouds - you will need to switch `westus` out for another region. You can find which regions are available by running:
~> **Note**: If you're using the **China** or **Government** Azure Clouds - you will need to switch `westus` out for another region. You can find which regions are available by running:

```shell
az account list-locations
Expand Down
Loading