internal/backend/remote-state/azure: code changes for go-azure-helpers v0.18.0

This commit is contained in:
tombuildsstuff 2021-11-17 18:26:23 +01:00
parent cf56f42328
commit 5133d30b71
1 changed files with 2 additions and 14 deletions

View File

@ -96,13 +96,13 @@ func buildArmClient(ctx context.Context, config BackendConfig) (*ArmClient, erro
} }
sender := sender.BuildSender("backend/remote-state/azure") sender := sender.BuildSender("backend/remote-state/azure")
auth, err := armConfig.GetAuthorizationToken(sender, oauthConfig, env.TokenAudience) auth, err := armConfig.GetADALToken(ctx, sender, oauthConfig, env.TokenAudience)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if config.UseAzureADAuthentication { if config.UseAzureADAuthentication {
storageAuth, err := armConfig.GetAuthorizationToken(sender, oauthConfig, env.ResourceIdentifiers.Storage) storageAuth, err := armConfig.GetADALToken(ctx, sender, oauthConfig, env.ResourceIdentifiers.Storage)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -120,18 +120,6 @@ func buildArmClient(ctx context.Context, config BackendConfig) (*ArmClient, erro
return &client, nil return &client, nil
} }
func buildArmEnvironment(config BackendConfig) (*azure.Environment, error) {
// TODO: can we remove this?
// https://github.com/hashicorp/terraform/issues/27156
if config.CustomResourceManagerEndpoint != "" {
log.Printf("[DEBUG] Loading Environment from Endpoint %q", config.CustomResourceManagerEndpoint)
return authentication.LoadEnvironmentFromUrl(config.CustomResourceManagerEndpoint)
}
log.Printf("[DEBUG] Loading Environment %q", config.Environment)
return authentication.DetermineEnvironment(config.Environment)
}
func (c ArmClient) getBlobClient(ctx context.Context) (*blobs.Client, error) { func (c ArmClient) getBlobClient(ctx context.Context) (*blobs.Client, error) {
if c.sasToken != "" { if c.sasToken != "" {
log.Printf("[DEBUG] Building the Blob Client from a SAS Token") log.Printf("[DEBUG] Building the Blob Client from a SAS Token")