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

Upgrade keyvault SDK #16955

Merged
merged 2 commits into from
May 26, 2022
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/hashicorp/terraform-provider-azurerm

require (
github.com/Azure/azure-sdk-for-go v64.0.0+incompatible
github.com/Azure/azure-sdk-for-go v64.1.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.26
github.com/Azure/go-autorest/autorest/date v0.3.0
github.com/Azure/go-autorest/autorest/to v0.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ cloud.google.com/go/storage v1.16.0/go.mod h1:ieKBmUyzcftN5tbxwnXClMKH00CfcQ+xL6
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/Azure/azure-sdk-for-go v45.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v56.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v64.0.0+incompatible h1:WAA77WBDWYtNfCC95V70VvkdzHe+wM/r2MQ9mG7fnQs=
github.com/Azure/azure-sdk-for-go v64.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v64.1.0+incompatible h1:FpsZmWR9FfEr9hP6K9S7RP0EkSFgGd6P1F2scHtbhnU=
github.com/Azure/azure-sdk-for-go v64.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest v0.11.3/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw=
Expand Down
2 changes: 1 addition & 1 deletion internal/services/keyvault/access_policy_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package keyvault
import (
"strings"

"github.com/Azure/azure-sdk-for-go/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault"
"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault"
"github.com/gofrs/uuid"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
Expand Down
2 changes: 1 addition & 1 deletion internal/services/keyvault/client/client.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package client

import (
"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault"
keyvaultmgmt "github.com/Azure/azure-sdk-for-go/services/keyvault/v7.1/keyvault"
"github.com/Azure/azure-sdk-for-go/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

Expand Down
26 changes: 13 additions & 13 deletions internal/services/keyvault/key_vault_access_policy_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault"
"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
)
Expand Down Expand Up @@ -82,18 +82,18 @@ func dataSourceKeyVaultAccessPolicyRead(d *pluginsdk.ResourceData, _ interface{}
string(keyvault.SecretPermissionsRestore),
},
"certificate": {
string(keyvault.Get),
string(keyvault.List),
string(keyvault.Update),
string(keyvault.Create),
string(keyvault.Import),
string(keyvault.Delete),
string(keyvault.Managecontacts),
string(keyvault.Manageissuers),
string(keyvault.Getissuers),
string(keyvault.Listissuers),
string(keyvault.Setissuers),
string(keyvault.Deleteissuers),
string(keyvault.CertificatePermissionsGet),
string(keyvault.CertificatePermissionsList),
string(keyvault.CertificatePermissionsUpdate),
string(keyvault.CertificatePermissionsCreate),
string(keyvault.CertificatePermissionsImport),
string(keyvault.CertificatePermissionsDelete),
string(keyvault.CertificatePermissionsManagecontacts),
string(keyvault.CertificatePermissionsManageissuers),
string(keyvault.CertificatePermissionsGetissuers),
string(keyvault.CertificatePermissionsListissuers),
string(keyvault.CertificatePermissionsSetissuers),
string(keyvault.CertificatePermissionsDeleteissuers),
},
}

Expand Down
14 changes: 7 additions & 7 deletions internal/services/keyvault/key_vault_access_policy_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse"

"github.com/Azure/azure-sdk-for-go/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault"
"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault"
"github.com/gofrs/uuid"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
Expand Down Expand Up @@ -152,7 +152,7 @@ func resourceKeyVaultAccessPolicyCreateOrDelete(d *pluginsdk.ResourceData, meta

var accessPolicy keyvault.AccessPolicyEntry
switch action {
case keyvault.Remove:
case keyvault.AccessPolicyUpdateKindRemove:
// To remove a policy correctly, we need to send it with all permissions in the correct case which may have drifted
// in config over time so we read it back from the vault by objectId
resp, err := client.Get(ctx, vaultId.ResourceGroup, vaultId.Name)
Expand Down Expand Up @@ -230,13 +230,13 @@ func resourceKeyVaultAccessPolicyCreateOrDelete(d *pluginsdk.ResourceData, meta
Timeout: d.Timeout(pluginsdk.TimeoutCreate),
}

if action == keyvault.Remove {
if action == keyvault.AccessPolicyUpdateKindRemove {
stateConf.Target = []string{"notfound"}
stateConf.Pending = []string{"found", "vaultnotfound"}
stateConf.Timeout = d.Timeout(pluginsdk.TimeoutDelete)
}

if action == keyvault.Replace {
if action == keyvault.AccessPolicyUpdateKindReplace {
stateConf.Timeout = d.Timeout(pluginsdk.TimeoutUpdate)
}

Expand All @@ -252,15 +252,15 @@ func resourceKeyVaultAccessPolicyCreateOrDelete(d *pluginsdk.ResourceData, meta
}

func resourceKeyVaultAccessPolicyCreate(d *pluginsdk.ResourceData, meta interface{}) error {
return resourceKeyVaultAccessPolicyCreateOrDelete(d, meta, keyvault.Add)
return resourceKeyVaultAccessPolicyCreateOrDelete(d, meta, keyvault.AccessPolicyUpdateKindAdd)
}

func resourceKeyVaultAccessPolicyDelete(d *pluginsdk.ResourceData, meta interface{}) error {
return resourceKeyVaultAccessPolicyCreateOrDelete(d, meta, keyvault.Remove)
return resourceKeyVaultAccessPolicyCreateOrDelete(d, meta, keyvault.AccessPolicyUpdateKindRemove)
}

func resourceKeyVaultAccessPolicyUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
return resourceKeyVaultAccessPolicyCreateOrDelete(d, meta, keyvault.Replace)
return resourceKeyVaultAccessPolicyCreateOrDelete(d, meta, keyvault.AccessPolicyUpdateKindReplace)
}

func resourceKeyVaultAccessPolicyRead(d *pluginsdk.ResourceData, meta interface{}) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/services/keyvault/key_vault_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault"
"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault"
"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault"
"github.com/gofrs/uuid"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
Expand Down Expand Up @@ -55,7 +55,7 @@ func resourceKeyVaultManagedHardwareSecurityModule() *pluginsdk.Resource {
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
string(keyvault.StandardB1),
string(keyvault.ManagedHsmSkuNameStandardB1),
}, false),
},

Expand Down
18 changes: 9 additions & 9 deletions internal/services/keyvault/key_vault_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault"
KeyVaultMgmt "github.com/Azure/azure-sdk-for-go/services/keyvault/v7.1/keyvault"
"github.com/Azure/azure-sdk-for-go/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault"
"github.com/gofrs/uuid"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
Expand Down Expand Up @@ -79,8 +79,8 @@ func resourceKeyVault() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
string(keyvault.Standard),
string(keyvault.Premium),
string(keyvault.SkuNameStandard),
string(keyvault.SkuNamePremium),
}, false),
},

Expand Down Expand Up @@ -153,16 +153,16 @@ func resourceKeyVault() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
string(keyvault.Allow),
string(keyvault.Deny),
string(keyvault.NetworkRuleActionAllow),
string(keyvault.NetworkRuleActionDeny),
}, false),
},
"bypass": {
Type: pluginsdk.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
string(keyvault.None),
string(keyvault.AzureServices),
string(keyvault.NetworkRuleBypassOptionsNone),
string(keyvault.NetworkRuleBypassOptionsAzureServices),
}, false),
},
"ip_rules": {
Expand Down Expand Up @@ -871,8 +871,8 @@ func flattenKeyVaultNetworkAcls(input *keyvault.NetworkRuleSet) []interface{} {
if input == nil {
return []interface{}{
map[string]interface{}{
"bypass": string(keyvault.AzureServices),
"default_action": string(keyvault.Allow),
"bypass": string(keyvault.NetworkRuleBypassOptionsAzureServices),
"default_action": string(keyvault.NetworkRuleActionAllow),
"ip_rules": pluginsdk.NewSet(pluginsdk.HashString, []interface{}{}),
"virtual_network_subnet_ids": pluginsdk.NewSet(pluginsdk.HashString, []interface{}{}),
},
Expand Down
Loading