Skip to content

Commit

Permalink
storage version upgrade from 2019-06-01 to 2021-01-01 (#11094)
Browse files Browse the repository at this point in the history
  • Loading branch information
yupwei68 authored Mar 30, 2021
1 parent 804ffb8 commit 0857527
Show file tree
Hide file tree
Showing 41 changed files with 1,522 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/Azure/azure-sdk-for-go/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices"
"github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/storage/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storagesync/mgmt/2020-03-01/storagesync"
"github.com/Azure/go-autorest/autorest"
az "github.com/Azure/go-autorest/autorest/azure"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/storage/client/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"sync"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/storage/parse"
)

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/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/acceptance"
Expand All @@ -18,14 +18,14 @@ import (
type StorageAccountCustomerManagedKeyResource struct{}

func TestAccStorageAccountCustomerManagedKey_basic(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_storage_account_customer_managed_key", "test")
data := acceptance.BuildTestData(t, "azurerm_storage_account", "test")
r := StorageAccountCustomerManagedKeyResource{}

data.ResourceTest(t, r, []resource.TestStep{
{
Config: r.basic(data),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That("azurerm_storage_account_customer_managed_key.test").ExistsInAzure(r),
),
},
data.ImportStep(),
Expand Down Expand Up @@ -101,7 +101,7 @@ func TestAccStorageAccountCustomerManagedKey_testKeyVersion(t *testing.T) {
}

func (r StorageAccountCustomerManagedKeyResource) accountHasDefaultSettings(ctx context.Context, client *clients.Client, state *terraform.InstanceState) error {
accountId, err := storageParse.StorageAccountID(state.Attributes["storage_account_id"])
accountId, err := storageParse.StorageAccountID(state.Attributes["id"])
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
azautorest "github.com/Azure/go-autorest/autorest"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
10 changes: 5 additions & 5 deletions azurerm/internal/services/storage/storage_account_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
azautorest "github.com/Azure/go-autorest/autorest"
autorestAzure "github.com/Azure/go-autorest/autorest/azure"
"github.com/hashicorp/go-azure-helpers/response"
Expand Down Expand Up @@ -229,7 +229,7 @@ func resourceStorageAccount() *schema.Resource {
Required: true,
DiffSuppressFunc: suppress.CaseDifference,
ValidateFunc: validation.StringInSlice([]string{
"SystemAssigned",
string(storage.IdentityTypeSystemAssigned),
}, true),
},
"principal_id": {
Expand Down Expand Up @@ -1973,7 +1973,7 @@ func expandAzureRmStorageAccountIdentity(d *schema.ResourceData) *storage.Identi
identity := identities[0].(map[string]interface{})
identityType := identity["type"].(string)
return &storage.Identity{
Type: &identityType,
Type: storage.IdentityType(identityType),
}
}

Expand All @@ -1983,8 +1983,8 @@ func flattenAzureRmStorageAccountIdentity(identity *storage.Identity) []interfac
}

result := make(map[string]interface{})
if identity.Type != nil {
result["type"] = *identity.Type
if identity.Type != "" {
result["type"] = string(identity.Type)
}
if identity.PrincipalID != nil {
result["principal_id"] = *identity.PrincipalID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"strings"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func TestAccStorageBlob_pageFromExistingBlob(t *testing.T) {
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("parallelism", "size", "type"),
data.ImportStep("parallelism", "size", "type", "source_uri"),
})
}

Expand All @@ -361,7 +361,7 @@ func TestAccStorageBlob_pageFromLocalFile(t *testing.T) {
data.CheckWithClient(r.blobMatchesFile(blobs.PageBlob, sourceBlob.Name())),
),
},
data.ImportStep("parallelism", "size", "type"),
data.ImportStep("parallelism", "size", "type", "source"),
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ resource "azurerm_storage_account" "test" {
location = azurerm_resource_group.test.location
account_tier = "Standard"
account_replication_type = "LRS"
allow_blob_public_access = true
tags = {
environment = "staging"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"testing"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/acceptance"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ func TestAccDataSourceStorageManagementPolicy_basic(t *testing.T) {
check.That(data.ResourceName).Key("rule.0.enabled").HasValue("true"),
check.That(data.ResourceName).Key("rule.0.filters.#").HasValue("1"),
check.That(data.ResourceName).Key("rule.0.filters.0.prefix_match.#").HasValue("1"),
check.That(data.ResourceName).Key("rule.0.filters.0.prefix_match.3439697764").HasValue("container1/prefix1"),
check.That(data.ResourceName).Key("rule.0.filters.0.blob_types.#").HasValue("1"),
check.That(data.ResourceName).Key("rule.0.filters.0.blob_types.1068358194").HasValue("blockBlob"),
check.That(data.ResourceName).Key("rule.0.actions.#").HasValue("1"),
check.That(data.ResourceName).Key("rule.0.actions.0.base_blob.#").HasValue("1"),
check.That(data.ResourceName).Key("rule.0.actions.0.base_blob.0.tier_to_cool_after_days_since_modification_greater_than").HasValue("10"),
Expand All @@ -50,10 +48,7 @@ func TestAccDataSourceStorageManagementPolicy_blobTypes(t *testing.T) {
check.That(data.ResourceName).Key("rule.0.enabled").HasValue("true"),
check.That(data.ResourceName).Key("rule.0.filters.#").HasValue("1"),
check.That(data.ResourceName).Key("rule.0.filters.0.prefix_match.#").HasValue("1"),
check.That(data.ResourceName).Key("rule.0.filters.0.prefix_match.3439697764").HasValue("container1/prefix1"),
check.That(data.ResourceName).Key("rule.0.filters.0.blob_types.#").HasValue("2"),
check.That(data.ResourceName).Key("rule.0.filters.0.blob_types.1068358194").HasValue("blockBlob"),
check.That(data.ResourceName).Key("rule.0.filters.0.blob_types.932666486").HasValue("appendBlob"),
check.That(data.ResourceName).Key("rule.0.actions.#").HasValue("1"),
check.That(data.ResourceName).Key("rule.0.actions.0.base_blob.#").HasValue("1"),
check.That(data.ResourceName).Key("rule.0.actions.0.base_blob.0.delete_after_days_since_modification_greater_than").HasValue("100"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
Loading

0 comments on commit 0857527

Please sign in to comment.