Skip to content

Commit b66364f

Browse files
committed
AzureRM backend: correctly lookup environment from metadata host
1 parent a7e43df commit b66364f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

backend/remote-state/azure/arm_client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ type ArmClient struct {
3333
sasToken string
3434
}
3535

36-
func buildArmClient(config BackendConfig) (*ArmClient, error) {
37-
env, err := buildArmEnvironment(config)
36+
func buildArmClient(ctx context.Context, config BackendConfig) (*ArmClient, error) {
37+
env, err := authentication.AzureEnvironmentByNameFromEndpoint(ctx, config.MetadataHost, config.Environment)
3838
if err != nil {
3939
return nil, err
4040
}

backend/remote-state/azure/helpers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func buildTestClient(t *testing.T, res resourceNames) *ArmClient {
7373
// Endpoint is optional (only for Stack)
7474
endpoint := os.Getenv("ARM_ENDPOINT")
7575

76-
armClient, err := buildArmClient(BackendConfig{
76+
armClient, err := buildArmClient(context.TODO(), BackendConfig{
7777
SubscriptionID: subscriptionID,
7878
TenantID: tenantID,
7979
ClientID: clientID,

0 commit comments

Comments
 (0)