Skip to content

Commit

Permalink
Upgrading to use the refactored package
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Sep 12, 2017
1 parent 1b03141 commit 0c3b7a0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/hashicorp/terraform/helper/mutexkv"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
"github.com/Azure/go-autorest/autorest/adal/cli"
)

// Provider returns a terraform.ResourceProvider.
Expand Down Expand Up @@ -210,12 +211,12 @@ func (c *Config) validateBearerAuth() error {
}

func (c *Config) LoadTokensFromAzureCLI() error {
profilePath, err := adal.AzureCLIProfilePath()
profilePath, err := cli.AzureCLIProfilePath()
if err != nil {
return fmt.Errorf("Error loading the Profile Path from the Azure CLI: %+v", err)
}

profile, err := adal.LoadCLIProfile(profilePath)
profile, err := cli.LoadCLIProfile(profilePath)
if err != nil {
return fmt.Errorf("Error loading Profile from the Azure CLI: %+v", err)
}
Expand All @@ -232,12 +233,12 @@ func (c *Config) LoadTokensFromAzureCLI() error {
}

// pull out the ClientID and the AccessToken from the Azure Access Token
tokensPath, err := adal.AzureCLIAccessTokensPath()
tokensPath, err := cli.AzureCLIAccessTokensPath()
if err != nil {
return fmt.Errorf("Error loading the Tokens Path from the Azure CLI: %+v", err)
}

tokens, err := adal.LoadCLITokens(tokensPath)
tokens, err := cli.LoadCLITokens(tokensPath)
if err != nil {
return fmt.Errorf("Error loading Access Tokens from the Azure CLI: %+v", err)
}
Expand All @@ -249,7 +250,7 @@ func (c *Config) LoadTokensFromAzureCLI() error {
return fmt.Errorf("[DEBUG] Error converting access token to token: %+v", err)
}

expirationDate, err := adal.ParseAzureCLIExpirationDate(accessToken.ExpiresOn)
expirationDate, err := cli.ParseAzureCLIExpirationDate(accessToken.ExpiresOn)
if err != nil {
return fmt.Errorf("Error parsing expiration date: %q", accessToken.ExpiresOn)
}
Expand Down

0 comments on commit 0c3b7a0

Please sign in to comment.