Skip to content

Commit

Permalink
Use vaultsClient instead or ArmClient
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcturusZhang committed Jan 8, 2020
1 parent 1fd3aec commit 4b1da8b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2018-02-14/keyvault"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
Expand Down Expand Up @@ -142,7 +143,7 @@ func resourceArmDiskEncryptionSetCreateUpdate(d *schema.ResourceData, meta inter
diskEncryptionSet.Identity = expandArmDiskEncryptionSetIdentity(d)

// validate whether the keyvault has soft-delete and purge-protection enabled
if err := validateKeyVault(ctx, meta.(*clients.Client), resourceGroup, *keyVaultID); err != nil {
if err := validateKeyVault(ctx, meta.(*clients.Client).KeyVault.VaultsClient, resourceGroup, *keyVaultID); err != nil {
return fmt.Errorf("Error creating Disk Encryption Set %q (Resource Group %q): %+v", name, resourceGroup, err)
}

Expand All @@ -166,8 +167,7 @@ func resourceArmDiskEncryptionSetCreateUpdate(d *schema.ResourceData, meta inter
return resourceArmDiskEncryptionSetRead(d, meta)
}

func validateKeyVault(ctx context.Context, armClient *clients.Client, resourceGroup string, keyVaultID string) error {
client := armClient.KeyVault.VaultsClient
func validateKeyVault(ctx context.Context, client *keyvault.VaultsClient, resourceGroup string, keyVaultID string) error {
parsedId, err := azure.ParseAzureResourceID(keyVaultID)
if err != nil {
return fmt.Errorf("Error parsing ID for keyvault in Disk Encryption Set: %+v", err)
Expand Down

0 comments on commit 4b1da8b

Please sign in to comment.