diff --git a/azurerm/internal/services/storage/resource_arm_storage_account.go b/azurerm/internal/services/storage/resource_arm_storage_account.go index 43b75f5d858c..6c915fb7d480 100644 --- a/azurerm/internal/services/storage/resource_arm_storage_account.go +++ b/azurerm/internal/services/storage/resource_arm_storage_account.go @@ -8,10 +8,6 @@ import ( "strings" "time" - "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/iothub" - "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/network" - - "github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v1.0/security" "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-04-01/storage" azautorest "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/go-azure-helpers/response" @@ -24,6 +20,8 @@ import ( "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/locks" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/iothub" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/network" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" @@ -80,15 +78,6 @@ func resourceArmStorageAccount() *schema.Resource { Default: string(storage.Storage), }, - "account_type": { - Type: schema.TypeString, - Optional: true, - Computed: true, - Deprecated: "This field has been split into `account_tier` and `account_replication_type`", - ValidateFunc: ValidateArmStorageAccountType, - DiffSuppressFunc: suppress.CaseDifference, - }, - "account_tier": { Type: schema.TypeString, Required: true, @@ -178,14 +167,6 @@ func resourceArmStorageAccount() *schema.Resource { ForceNew: true, }, - // TODO remove this in 2.0 for the dedicated resource - "enable_advanced_threat_protection": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - Deprecated: "This property has been deprecated in favour of the new 'azurerm_advanced_threat_protection' resource and will be removed in version 2.0 of the provider", - }, - "network_rules": { Type: schema.TypeList, Optional: true, @@ -612,7 +593,6 @@ func validateAzureRMStorageAccountTags(v interface{}, _ string) (warnings []stri func resourceArmStorageAccountCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Storage.AccountsClient - advancedThreatProtectionClient := meta.(*clients.Client).SecurityCenter.AdvancedThreatProtectionClient ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -732,22 +712,6 @@ func resourceArmStorageAccountCreate(d *schema.ResourceData, meta interface{}) e log.Printf("[INFO] storage account %q ID: %q", storageAccountName, *account.ID) d.SetId(*account.ID) - // TODO: deprecate & split this out into it's own resource in 2.0 - // as this is not available in all regions, and presumably off by default - // lets only try to set this value when true - // TODO in 2.0 switch to guarding this with d.GetOkExists() ? - if v := d.Get("enable_advanced_threat_protection").(bool); v { - advancedThreatProtectionSetting := security.AdvancedThreatProtectionSetting{ - AdvancedThreatProtectionProperties: &security.AdvancedThreatProtectionProperties{ - IsEnabled: utils.Bool(v), - }, - } - - if _, err = advancedThreatProtectionClient.Create(ctx, d.Id(), advancedThreatProtectionSetting); err != nil { - return fmt.Errorf("Error updating Azure Storage Account enable_advanced_threat_protection %q: %+v", storageAccountName, err) - } - } - if val, ok := d.GetOk("blob_properties"); ok { // FileStorage does not support blob settings if accountKind != string(storage.FileStorage) { @@ -810,7 +774,6 @@ func resourceArmStorageAccountCreate(d *schema.ResourceData, meta interface{}) e // available requires a call to Update per parameter... func resourceArmStorageAccountUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Storage.AccountsClient - advancedThreatProtectionClient := meta.(*clients.Client).SecurityCenter.AdvancedThreatProtectionClient ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -969,20 +932,6 @@ func resourceArmStorageAccountUpdate(d *schema.ResourceData, meta interface{}) e d.SetPartial("network_rules") } - if d.HasChange("enable_advanced_threat_protection") { - opts := security.AdvancedThreatProtectionSetting{ - AdvancedThreatProtectionProperties: &security.AdvancedThreatProtectionProperties{ - IsEnabled: utils.Bool(d.Get("enable_advanced_threat_protection").(bool)), - }, - } - - if _, err := advancedThreatProtectionClient.Create(ctx, d.Id(), opts); err != nil { - return fmt.Errorf("Error updating Azure Storage Account enable_advanced_threat_protection %q: %+v", storageAccountName, err) - } - - d.SetPartial("enable_advanced_threat_protection") - } - if d.HasChange("blob_properties") { // FileStorage does not support blob settings if accountKind != string(storage.FileStorage) { @@ -1048,7 +997,6 @@ func resourceArmStorageAccountUpdate(d *schema.ResourceData, meta interface{}) e func resourceArmStorageAccountRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Storage.AccountsClient - advancedThreatProtectionClient := meta.(*clients.Client).SecurityCenter.AdvancedThreatProtectionClient endpointSuffix := meta.(*clients.Client).Account.Environment.StorageEndpointSuffix ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -1102,7 +1050,6 @@ func resourceArmStorageAccountRead(d *schema.ResourceData, meta interface{}) err d.Set("account_kind", resp.Kind) if sku := resp.Sku; sku != nil { - d.Set("account_type", sku.Name) d.Set("account_tier", sku.Tier) d.Set("account_replication_type", strings.Split(fmt.Sprintf("%v", sku.Name), "_")[1]) } @@ -1189,23 +1136,6 @@ func resourceArmStorageAccountRead(d *schema.ResourceData, meta interface{}) err return err } - // TODO in 2.0 switch to guarding this with d.GetOkExists() - atp, err := advancedThreatProtectionClient.Get(ctx, d.Id()) - if err != nil { - msg := err.Error() - if !strings.Contains(msg, "The resource namespace 'Microsoft.Security' is invalid.") { - if !strings.Contains(msg, "No registered resource provider found for location '") { - if !strings.Contains(msg, "' and API version '2017-08-01-preview' for type ") { - return fmt.Errorf("Error reading the advanced threat protection settings of AzureRM Storage Account %q: %+v", name, err) - } - } - } - } else { - if atpp := atp.AdvancedThreatProtectionProperties; atpp != nil { - d.Set("enable_advanced_threat_protection", atpp.IsEnabled) - } - } - storageClient := meta.(*clients.Client).Storage account, err := storageClient.FindAccount(ctx, name) if err != nil { diff --git a/azurerm/internal/services/storage/resource_arm_storage_account_network_rules.go b/azurerm/internal/services/storage/resource_arm_storage_account_network_rules.go index a85b4e115b25..7bbfda7558ce 100644 --- a/azurerm/internal/services/storage/resource_arm_storage_account_network_rules.go +++ b/azurerm/internal/services/storage/resource_arm_storage_account_network_rules.go @@ -115,11 +115,15 @@ func resourceArmStorageAccountNetworkRulesCreateUpdate(d *schema.ResourceData, m return fmt.Errorf("Storage Account %q (Resource Group %q) was not found", storageAccountName, resourceGroup) } - return fmt.Errorf("Error loading Storage Account %q (Resource Group %q): %+v", storageAccountName, resourceGroup, err) + return fmt.Errorf("Error retrieving Storage Account %q (Resource Group %q): %+v", storageAccountName, resourceGroup, err) } - if features.ShouldResourcesBeImported() { - if checkForNonDefaultStorageAccountNetworkRule(storageAccount.NetworkRuleSet) { + if features.ShouldResourcesBeImported() && d.IsNewResource() { + if storageAccount.AccountProperties == nil { + return fmt.Errorf("Error retrieving Storage Account %q (Resource Group %q): `properties` was nil", storageAccountName, resourceGroup) + } + + if checkForNonDefaultStorageAccountNetworkRule(storageAccount.AccountProperties.NetworkRuleSet) { return tf.ImportAsExistsError("azurerm_storage_account_network_rule", *storageAccount.ID) } } @@ -247,8 +251,8 @@ func checkForNonDefaultStorageAccountNetworkRule(rule *storage.NetworkRuleSet) b return false } - if rule.IPRules != nil || len(*rule.IPRules) != 0 || - rule.VirtualNetworkRules != nil || len(*rule.VirtualNetworkRules) == 0 || + if (rule.IPRules != nil && len(*rule.IPRules) != 0) || + (rule.VirtualNetworkRules != nil && len(*rule.VirtualNetworkRules) != 0) || rule.Bypass != "AzureServices" || rule.DefaultAction != "Allow" { return true } diff --git a/azurerm/internal/services/storage/resource_arm_storage_blob.go b/azurerm/internal/services/storage/resource_arm_storage_blob.go index bcf7801da9db..d9d469f5774b 100644 --- a/azurerm/internal/services/storage/resource_arm_storage_blob.go +++ b/azurerm/internal/services/storage/resource_arm_storage_blob.go @@ -8,8 +8,6 @@ import ( "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" - "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/suppress" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" @@ -61,15 +59,14 @@ func resourceArmStorageBlob() *schema.Resource { }, "type": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: suppress.CaseDifference, // TODO: remove in 2.0 + Type: schema.TypeString, + Required: true, + ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ "Append", "Block", "Page", - }, true), + }, false), }, "size": { @@ -133,18 +130,6 @@ func resourceArmStorageBlob() *schema.Resource { }, "metadata": MetaDataComputedSchema(), - - // Deprecated fields - "attempts": { - Type: schema.TypeInt, - Optional: true, - Default: 1, - ForceNew: true, - Deprecated: "Retries are now handled by the Azure SDK as such this field is no longer necessary and will be removed in v2.0 of the Azure Provider", - ValidateFunc: validation.IntAtLeast(1), - }, - - "resource_group_name": azure.SchemaResourceGroupNameDeprecated(), }, } } @@ -314,7 +299,6 @@ func resourceArmStorageBlobRead(d *schema.ResourceData, meta interface{}) error d.Set("name", id.BlobName) d.Set("storage_container_name", id.ContainerName) d.Set("storage_account_name", id.AccountName) - d.Set("resource_group_name", account.ResourceGroup) d.Set("access_tier", string(props.AccessTier)) d.Set("content_type", props.ContentType) diff --git a/azurerm/internal/services/storage/resource_arm_storage_container.go b/azurerm/internal/services/storage/resource_arm_storage_container.go index 0971adb3adaa..2efbdf815469 100644 --- a/azurerm/internal/services/storage/resource_arm_storage_container.go +++ b/azurerm/internal/services/storage/resource_arm_storage_container.go @@ -7,7 +7,6 @@ import ( "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" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" @@ -75,17 +74,6 @@ func resourceArmStorageContainer() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - - "resource_group_name": azure.SchemaResourceGroupNameDeprecated(), - - "properties": { - Type: schema.TypeMap, - Computed: true, - Deprecated: "This field will be removed in version 2.0 of the Azure Provider", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, }, } } @@ -229,7 +217,6 @@ func resourceArmStorageContainerRead(d *schema.ResourceData, meta interface{}) e d.Set("name", id.ContainerName) d.Set("storage_account_name", id.AccountName) - d.Set("resource_group_name", account.ResourceGroup) d.Set("container_access_type", flattenStorageContainerAccessLevel(props.AccessLevel)) @@ -237,10 +224,6 @@ func resourceArmStorageContainerRead(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("Error setting `metadata`: %+v", err) } - if err := d.Set("properties", flattenStorageContainerProperties(props)); err != nil { - return fmt.Errorf("Error setting `properties`: %+v", err) - } - d.Set("has_immutability_policy", props.HasImmutabilityPolicy) d.Set("has_legal_hold", props.HasLegalHold) @@ -277,21 +260,6 @@ func resourceArmStorageContainerDelete(d *schema.ResourceData, meta interface{}) return nil } -func flattenStorageContainerProperties(input containers.ContainerProperties) map[string]interface{} { - output := map[string]interface{}{ - "last_modified": input.Header.Get("Last-Modified"), - "lease_duration": "", - "lease_state": string(input.LeaseState), - "lease_status": string(input.LeaseStatus), - } - - if input.LeaseDuration != nil { - output["lease_duration"] = string(*input.LeaseDuration) - } - - return output -} - func expandStorageContainerAccessLevel(input string) containers.AccessLevel { // for historical reasons, "private" above is an empty string in the API // so the enum doesn't 1:1 match. You could argue the SDK should handle this diff --git a/azurerm/internal/services/storage/resource_arm_storage_queue.go b/azurerm/internal/services/storage/resource_arm_storage_queue.go index b512884cd6fb..ba77e57565ba 100644 --- a/azurerm/internal/services/storage/resource_arm_storage_queue.go +++ b/azurerm/internal/services/storage/resource_arm_storage_queue.go @@ -7,7 +7,6 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" @@ -50,8 +49,6 @@ func resourceArmStorageQueue() *schema.Resource { ValidateFunc: ValidateArmStorageAccountName, }, - "resource_group_name": azure.SchemaResourceGroupNameDeprecated(), - "metadata": MetaDataSchema(), }, } @@ -204,7 +201,6 @@ func resourceArmStorageQueueRead(d *schema.ResourceData, meta interface{}) error d.Set("name", id.QueueName) d.Set("storage_account_name", id.AccountName) - d.Set("resource_group_name", account.ResourceGroup) if err := d.Set("metadata", FlattenMetaData(metaData.MetaData)); err != nil { return fmt.Errorf("Error setting `metadata`: %s", err) diff --git a/azurerm/internal/services/storage/resource_arm_storage_share.go b/azurerm/internal/services/storage/resource_arm_storage_share.go index 04eb1ff53585..9c4edd8c7a43 100644 --- a/azurerm/internal/services/storage/resource_arm_storage_share.go +++ b/azurerm/internal/services/storage/resource_arm_storage_share.go @@ -7,7 +7,6 @@ import ( "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" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" @@ -55,8 +54,6 @@ func resourceArmStorageShare() *schema.Resource { ValidateFunc: ValidateArmStorageShareName, }, - "resource_group_name": azure.SchemaResourceGroupNameDeprecated(), - "storage_account_name": { Type: schema.TypeString, Required: true, @@ -230,9 +227,6 @@ func resourceArmStorageShareRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error flattening `acl`: %+v", err) } - // Deprecated: remove in 2.0 - d.Set("resource_group_name", account.ResourceGroup) - return nil } diff --git a/azurerm/internal/services/storage/resource_arm_storage_table.go b/azurerm/internal/services/storage/resource_arm_storage_table.go index 7d2960cafec0..21d52120c07d 100644 --- a/azurerm/internal/services/storage/resource_arm_storage_table.go +++ b/azurerm/internal/services/storage/resource_arm_storage_table.go @@ -8,7 +8,6 @@ import ( "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" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" @@ -63,9 +62,6 @@ func resourceArmStorageTable() *schema.Resource { ValidateFunc: ValidateArmStorageAccountName, }, - // TODO: deprecate this in the docs - "resource_group_name": azure.SchemaResourceGroupNameDeprecated(), - "acl": { Type: schema.TypeSet, Optional: true, @@ -199,7 +195,6 @@ func resourceArmStorageTableRead(d *schema.ResourceData, meta interface{}) error d.Set("name", id.TableName) d.Set("storage_account_name", id.AccountName) - d.Set("resource_group_name", account.ResourceGroup) if err := d.Set("acl", flattenStorageTableACLs(acls)); err != nil { return fmt.Errorf("Error flattening `acl`: %+v", err) diff --git a/azurerm/internal/services/storage/tests/data_source_storage_account_blob_container_sas_test.go b/azurerm/internal/services/storage/tests/data_source_storage_account_blob_container_sas_test.go index 6b719546e072..ac44c2e5bd8a 100644 --- a/azurerm/internal/services/storage/tests/data_source_storage_account_blob_container_sas_test.go +++ b/azurerm/internal/services/storage/tests/data_source_storage_account_blob_container_sas_test.go @@ -65,7 +65,6 @@ resource "azurerm_storage_account" "storage" { resource "azurerm_storage_container" "container" { name = "sas-test" - resource_group_name = "${azurerm_resource_group.rg.name}" storage_account_name = "${azurerm_storage_account.storage.name}" container_access_type = "private" } diff --git a/azurerm/internal/services/storage/tests/data_source_storage_container_test.go b/azurerm/internal/services/storage/tests/data_source_storage_container_test.go index 351a2ab4e5a3..2797f681fb28 100644 --- a/azurerm/internal/services/storage/tests/data_source_storage_container_test.go +++ b/azurerm/internal/services/storage/tests/data_source_storage_container_test.go @@ -47,7 +47,6 @@ resource "azurerm_storage_account" "test" { resource "azurerm_storage_container" "test" { name = "containerdstest-%s" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "private" metadata = { diff --git a/azurerm/internal/services/storage/tests/data_source_storage_management_policy_test.go b/azurerm/internal/services/storage/tests/data_source_storage_management_policy_test.go index 2c1e9ad47d5a..28b5e8394d2d 100644 --- a/azurerm/internal/services/storage/tests/data_source_storage_management_policy_test.go +++ b/azurerm/internal/services/storage/tests/data_source_storage_management_policy_test.go @@ -9,7 +9,7 @@ import ( ) func TestAccDataSourceAzureRMStorageManagementPolicy_basic(t *testing.T) { - data := acceptance.BuildTestData(t, "data.azurerm_storage_account", "test") + data := acceptance.BuildTestData(t, "data.azurerm_storage_management_policy", "test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acceptance.PreCheck(t) }, diff --git a/azurerm/internal/services/storage/tests/resource_arm_storage_account_test.go b/azurerm/internal/services/storage/tests/resource_arm_storage_account_test.go index 808af49e9215..5e21e4e2761e 100644 --- a/azurerm/internal/services/storage/tests/resource_arm_storage_account_test.go +++ b/azurerm/internal/services/storage/tests/resource_arm_storage_account_test.go @@ -18,24 +18,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/terraform" ) -func TestValidateArmStorageAccountType(t *testing.T) { - testCases := []struct { - input string - shouldError bool - }{ - {"standard_lrs", false}, - {"invalid", true}, - } - - for _, test := range testCases { - _, es := storage.ValidateArmStorageAccountType(test.input, "account_type") - - if test.shouldError && len(es) == 0 { - t.Fatalf("Expected validating account_type %q to fail", test.input) - } - } -} - func TestValidateArmStorageAccountName(t *testing.T) { testCases := []struct { input string @@ -571,34 +553,6 @@ func TestAccAzureRMStorageAccount_networkRulesDeleted(t *testing.T) { }) } -func TestAccAzureRMStorageAccount_enableAdvancedThreatProtection(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_storage_account", "test") - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acceptance.PreCheck(t) }, - Providers: acceptance.SupportedProviders, - CheckDestroy: testCheckAzureRMStorageAccountDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAzureRMStorageAccount_enableAdvancedThreatProtection(data), - Check: resource.ComposeTestCheckFunc( - testCheckAzureRMStorageAccountExists(data.ResourceName), - resource.TestCheckResourceAttr(data.ResourceName, "enable_advanced_threat_protection", "true"), - ), - }, - data.ImportStep(), - { - Config: testAccAzureRMStorageAccount_enableAdvancedThreatProtectionDisabled(data), - Check: resource.ComposeTestCheckFunc( - testCheckAzureRMStorageAccountExists(data.ResourceName), - resource.TestCheckResourceAttr(data.ResourceName, "enable_advanced_threat_protection", "false"), - ), - }, - data.ImportStep(), - }, - }) -} - func TestAccAzureRMStorageAccount_blobProperties(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_storage_account", "test") @@ -1367,42 +1321,6 @@ resource "azurerm_storage_account" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomString) } -func testAccAzureRMStorageAccount_enableAdvancedThreatProtection(data acceptance.TestData) string { - return fmt.Sprintf(` -resource "azurerm_resource_group" "test" { - name = "acctestRG-storage-%d" - location = "%s" -} - -resource "azurerm_storage_account" "test" { - name = "unlikely23exst2acct%s" - resource_group_name = "${azurerm_resource_group.test.name}" - location = "${azurerm_resource_group.test.location}" - account_tier = "Standard" - account_replication_type = "LRS" - enable_advanced_threat_protection = true -} -`, data.RandomInteger, data.Locations.Primary, data.RandomString) -} - -func testAccAzureRMStorageAccount_enableAdvancedThreatProtectionDisabled(data acceptance.TestData) string { - return fmt.Sprintf(` -resource "azurerm_resource_group" "test" { - name = "acctestRG-storage-%d" - location = "%s" -} - -resource "azurerm_storage_account" "test" { - name = "unlikely23exst2acct%s" - resource_group_name = "${azurerm_resource_group.test.name}" - location = "${azurerm_resource_group.test.location}" - account_tier = "Standard" - account_replication_type = "LRS" - enable_advanced_threat_protection = false -} -`, data.RandomInteger, data.Locations.Primary, data.RandomString) -} - func testAccAzureRMStorageAccount_blobProperties(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { diff --git a/azurerm/internal/services/storage/tests/resource_arm_storage_blob_test.go b/azurerm/internal/services/storage/tests/resource_arm_storage_blob_test.go index ddc5438f401b..a1916bf6f030 100644 --- a/azurerm/internal/services/storage/tests/resource_arm_storage_blob_test.go +++ b/azurerm/internal/services/storage/tests/resource_arm_storage_blob_test.go @@ -54,7 +54,7 @@ func TestAccAzureRMStorageBlob_appendEmpty(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, }, }) @@ -78,7 +78,7 @@ func TestAccAzureRMStorageBlob_appendEmptyMetaData(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, }, }) @@ -102,7 +102,7 @@ func TestAccAzureRMStorageBlob_blockEmpty(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, }, }) @@ -126,7 +126,7 @@ func TestAccAzureRMStorageBlob_blockEmptyAzureADAuth(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, }, }) @@ -150,7 +150,7 @@ func TestAccAzureRMStorageBlob_blockEmptyMetaData(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, }, }) @@ -175,7 +175,7 @@ func TestAccAzureRMStorageBlob_blockEmptyAccessTier(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, { Config: testAccAzureRMStorageBlob_blockEmptyAccessTier(data, blobs.Hot), @@ -213,7 +213,7 @@ func TestAccAzureRMStorageBlob_blockFromInlineContent(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "source_content", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "source_content", "type"}, }, }, }) @@ -237,7 +237,7 @@ func TestAccAzureRMStorageBlob_blockFromPublicBlob(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "source_uri", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "source_uri", "type"}, }, }, }) @@ -261,7 +261,7 @@ func TestAccAzureRMStorageBlob_blockFromPublicFile(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "source_uri", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "source_uri", "type"}, }, }, }) @@ -285,7 +285,7 @@ func TestAccAzureRMStorageBlob_blockFromExistingBlob(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "source_uri", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "source_uri", "type"}, }, }, }) @@ -318,7 +318,7 @@ func TestAccAzureRMStorageBlob_blockFromLocalFile(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "source", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "source", "type"}, }, }, }) @@ -342,7 +342,7 @@ func TestAccAzureRMStorageBlob_contentType(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, { Config: testAccAzureRMStorageBlob_contentTypeUpdated(data), @@ -354,7 +354,7 @@ func TestAccAzureRMStorageBlob_contentType(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, }, }) @@ -378,7 +378,7 @@ func TestAccAzureRMStorageBlob_contentTypePremium(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, }, }) @@ -402,7 +402,7 @@ func TestAccAzureRMStorageBlob_pageEmpty(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, }, }) @@ -426,7 +426,7 @@ func TestAccAzureRMStorageBlob_pageEmptyPremium(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, }, }) @@ -450,7 +450,7 @@ func TestAccAzureRMStorageBlob_pageEmptyMetaData(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, }, }) @@ -474,7 +474,7 @@ func TestAccAzureRMStorageBlob_pageFromExistingBlob(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "source_uri", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "source_uri", "type"}, }, }, }) @@ -507,7 +507,7 @@ func TestAccAzureRMStorageBlob_pageFromLocalFile(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "source", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "source", "type"}, }, }, }) @@ -554,7 +554,7 @@ func TestAccAzureRMStorageBlob_update(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, { Config: testAccAzureRMStorageBlob_updateUpdated(data), @@ -566,7 +566,7 @@ func TestAccAzureRMStorageBlob_update(t *testing.T) { ResourceName: data.ResourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"attempts", "parallelism", "size", "type"}, + ImportStateVerifyIgnore: []string{"parallelism", "size", "type"}, }, }, }) @@ -763,10 +763,9 @@ func testAccAzureRMStorageBlob_appendEmpty(data acceptance.TestData) string { resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "append" + type = "Append" } `, template) } @@ -778,10 +777,9 @@ func testAccAzureRMStorageBlob_appendEmptyMetaData(data acceptance.TestData) str resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "append" + type = "Append" metadata = { hello = "world" @@ -797,10 +795,9 @@ func testAccAzureRMStorageBlob_blockEmpty(data acceptance.TestData) string { resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "block" + type = "Block" } `, template) } @@ -823,10 +820,9 @@ func testAccAzureRMStorageBlob_blockEmptyMetaData(data acceptance.TestData) stri resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "block" + type = "Block" metadata = { hello = "world" @@ -842,10 +838,9 @@ func testAccAzureRMStorageBlob_blockEmptyAccessTier(data acceptance.TestData, ac resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "block" + type = "Block" access_tier = "%s" } `, template, string(accessTier)) @@ -858,10 +853,9 @@ func testAccAzureRMStorageBlob_blockFromInlineContent(data acceptance.TestData) resource "azurerm_storage_blob" "test" { name = "rick.morty" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "block" + type = "Block" source_content = "Wubba Lubba Dub Dub" } `, template) @@ -874,27 +868,24 @@ func testAccAzureRMStorageBlob_blockFromPublicBlob(data acceptance.TestData) str resource "azurerm_storage_blob" "source" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "block" - source_uri = "http://releases.ubuntu.com/18.04.3/ubuntu-18.04.3-desktop-amd64.iso" + type = "Block" + source_uri = "http://old-releases.ubuntu.com/releases/bionic/ubuntu-18.04-desktop-amd64.iso" content_type = "application/x-iso9660-image" } resource "azurerm_storage_container" "second" { name = "second" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "private" } resource "azurerm_storage_blob" "test" { name = "copied.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.second.name}" - type = "block" + type = "Block" source_uri = "${azurerm_storage_blob.source.id}" content_type = "${azurerm_storage_blob.source.content_type}" } @@ -908,11 +899,10 @@ func testAccAzureRMStorageBlob_blockFromPublicFile(data acceptance.TestData) str resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "block" - source_uri = "http://releases.ubuntu.com/18.04.3/ubuntu-18.04.3-desktop-amd64.iso" + type = "Block" + source_uri = "http://old-releases.ubuntu.com/releases/bionic/ubuntu-18.04-desktop-amd64.iso" content_type = "application/x-iso9660-image" } `, template) @@ -925,20 +915,18 @@ func testAccAzureRMStorageBlob_blockFromExistingBlob(data acceptance.TestData) s resource "azurerm_storage_blob" "source" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "block" - source_uri = "http://releases.ubuntu.com/18.04.3/ubuntu-18.04.3-desktop-amd64.iso" + type = "Block" + source_uri = "http://old-releases.ubuntu.com/releases/bionic/ubuntu-18.04-desktop-amd64.iso" content_type = "application/x-iso9660-image" } resource "azurerm_storage_blob" "test" { name = "copied.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "block" + type = "Block" source_uri = "${azurerm_storage_blob.source.id}" content_type = "${azurerm_storage_blob.source.content_type}" } @@ -952,10 +940,9 @@ func testAccAzureRMStorageBlob_blockFromLocalBlob(data acceptance.TestData, file resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "block" + type = "Block" source = "%s" } `, template, fileName) @@ -968,10 +955,9 @@ func testAccAzureRMStorageBlob_contentType(data acceptance.TestData) string { resource "azurerm_storage_blob" "test" { name = "example.ext" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "page" + type = "Page" size = 5120 content_type = "image/png" } @@ -985,10 +971,9 @@ func testAccAzureRMStorageBlob_contentTypePremium(data acceptance.TestData) stri resource "azurerm_storage_blob" "test" { name = "example.ext" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "page" + type = "Page" size = 5120 content_type = "image/png" } @@ -1002,10 +987,9 @@ func testAccAzureRMStorageBlob_contentTypeUpdated(data acceptance.TestData) stri resource "azurerm_storage_blob" "test" { name = "example.ext" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "page" + type = "Page" size = 5120 content_type = "image/gif" } @@ -1019,10 +1003,9 @@ func testAccAzureRMStorageBlob_pageEmpty(data acceptance.TestData) string { resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "page" + type = "Page" size = 5120 } `, template) @@ -1035,10 +1018,9 @@ func testAccAzureRMStorageBlob_pageEmptyPremium(data acceptance.TestData) string resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "page" + type = "Page" size = 5120 } `, template) @@ -1051,10 +1033,9 @@ func testAccAzureRMStorageBlob_pageEmptyMetaData(data acceptance.TestData) strin resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "page" + type = "Page" size = 5120 metadata = { @@ -1071,20 +1052,18 @@ func testAccAzureRMStorageBlob_pageFromExistingBlob(data acceptance.TestData) st resource "azurerm_storage_blob" "source" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "page" + type = "Page" size = 5120 content_type = "application/x-iso9660-image" } resource "azurerm_storage_blob" "test" { name = "copied.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "page" + type = "Page" source_uri = "${azurerm_storage_blob.source.id}" content_type = "${azurerm_storage_blob.source.content_type}" } @@ -1098,10 +1077,9 @@ func testAccAzureRMStorageBlob_pageFromLocalBlob(data acceptance.TestData, fileN resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "page" + type = "Page" source = "%s" } `, template, fileName) @@ -1146,7 +1124,6 @@ func testAccAzureRMStorageBlob_requiresImport(data acceptance.TestData) string { resource "azurerm_storage_blob" "import" { name = "${azurerm_storage_blob.test.name}" - resource_group_name = "${azurerm_storage_blob.test.resource_group_name}" storage_account_name = "${azurerm_storage_blob.test.storage_account_name}" storage_container_name = "${azurerm_storage_blob.test.storage_container_name}" type = "${azurerm_storage_blob.test.type}" @@ -1162,10 +1139,9 @@ func testAccAzureRMStorageBlob_update(data acceptance.TestData) string { resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "block" + type = "Block" size = 5120 content_type = "vnd/panda+pops" metadata = { @@ -1182,10 +1158,9 @@ func testAccAzureRMStorageBlob_updateUpdated(data acceptance.TestData) string { resource "azurerm_storage_blob" "test" { name = "example.vhd" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" storage_container_name = "${azurerm_storage_container.test.name}" - type = "block" + type = "Block" size = 5120 content_type = "vnd/mountain-mover-3000" metadata = { @@ -1213,7 +1188,6 @@ resource "azurerm_storage_account" "test" { resource "azurerm_storage_container" "test" { name = "test" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "%s" } @@ -1238,7 +1212,6 @@ resource "azurerm_storage_account" "test" { resource "azurerm_storage_container" "test" { name = "test" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "%s" } @@ -1262,7 +1235,6 @@ resource "azurerm_storage_account" "test" { resource "azurerm_storage_container" "test" { name = "test" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "%s" } diff --git a/azurerm/internal/services/storage/tests/resource_arm_storage_container_test.go b/azurerm/internal/services/storage/tests/resource_arm_storage_container_test.go index 45753cc73f35..f1e8a151ed68 100644 --- a/azurerm/internal/services/storage/tests/resource_arm_storage_container_test.go +++ b/azurerm/internal/services/storage/tests/resource_arm_storage_container_test.go @@ -311,7 +311,6 @@ func testAccAzureRMStorageContainer_basic(data acceptance.TestData) string { resource "azurerm_storage_container" "test" { name = "vhds" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "private" } @@ -336,7 +335,6 @@ func testAccAzureRMStorageContainer_requiresImport(data acceptance.TestData) str resource "azurerm_storage_container" "import" { name = "${azurerm_storage_container.test.name}" - resource_group_name = "${azurerm_storage_container.test.resource_group_name}" storage_account_name = "${azurerm_storage_container.test.storage_account_name}" container_access_type = "${azurerm_storage_container.test.container_access_type}" } @@ -350,7 +348,6 @@ func testAccAzureRMStorageContainer_update(data acceptance.TestData, accessType resource "azurerm_storage_container" "test" { name = "vhds" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "%s" } @@ -364,7 +361,6 @@ func testAccAzureRMStorageContainer_metaData(data acceptance.TestData) string { resource "azurerm_storage_container" "test" { name = "vhds" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "private" @@ -382,7 +378,6 @@ func testAccAzureRMStorageContainer_metaDataUpdated(data acceptance.TestData) st resource "azurerm_storage_container" "test" { name = "vhds" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "private" @@ -401,7 +396,6 @@ func testAccAzureRMStorageContainer_metaDataEmpty(data acceptance.TestData) stri resource "azurerm_storage_container" "test" { name = "vhds" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "private" @@ -418,7 +412,6 @@ func testAccAzureRMStorageContainer_root(data acceptance.TestData) string { resource "azurerm_storage_container" "test" { name = "$root" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "private" } @@ -432,7 +425,6 @@ func testAccAzureRMStorageContainer_web(data acceptance.TestData) string { resource "azurerm_storage_container" "test" { name = "$web" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" container_access_type = "private" } diff --git a/azurerm/internal/services/storage/tests/resource_arm_storage_data_lake_gen2_filesystem_test.go b/azurerm/internal/services/storage/tests/resource_arm_storage_data_lake_gen2_filesystem_test.go index 44d993cc0c86..b43b5a26b687 100644 --- a/azurerm/internal/services/storage/tests/resource_arm_storage_data_lake_gen2_filesystem_test.go +++ b/azurerm/internal/services/storage/tests/resource_arm_storage_data_lake_gen2_filesystem_test.go @@ -155,7 +155,7 @@ func testAccAzureRMStorageDataLakeGen2FileSystem_requiresImport(data acceptance. resource "azurerm_storage_data_lake_gen2_filesystem" "import" { name = azurerm_storage_data_lake_gen2_filesystem.test.name - storage_account_id = azurerm_storage_data_lake_gen2_filesystem.storage_account_id + storage_account_id = azurerm_storage_data_lake_gen2_filesystem.test.storage_account_id } `, template) } diff --git a/azurerm/internal/services/storage/tests/resource_arm_storage_share_test.go b/azurerm/internal/services/storage/tests/resource_arm_storage_share_test.go index 211babe02046..be1d26afd4d9 100644 --- a/azurerm/internal/services/storage/tests/resource_arm_storage_share_test.go +++ b/azurerm/internal/services/storage/tests/resource_arm_storage_share_test.go @@ -266,7 +266,6 @@ func testAccAzureRMStorageShare_basic(data acceptance.TestData) string { resource "azurerm_storage_share" "test" { name = "testshare%s" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" } `, template, data.RandomString) @@ -279,7 +278,6 @@ func testAccAzureRMStorageShare_metaData(data acceptance.TestData) string { resource "azurerm_storage_share" "test" { name = "testshare%s" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" metadata = { @@ -296,7 +294,6 @@ func testAccAzureRMStorageShare_metaDataUpdated(data acceptance.TestData) string resource "azurerm_storage_share" "test" { name = "testshare%s" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" metadata = { @@ -314,7 +311,6 @@ func testAccAzureRMStorageShare_acl(data acceptance.TestData) string { resource "azurerm_storage_share" "test" { name = "testshare%s" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" acl { @@ -337,7 +333,6 @@ func testAccAzureRMStorageShare_aclUpdated(data acceptance.TestData) string { resource "azurerm_storage_share" "test" { name = "testshare%s" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" acl { @@ -368,7 +363,6 @@ func testAccAzureRMStorageShare_requiresImport(data acceptance.TestData) string resource "azurerm_storage_share" "import" { name = "${azurerm_storage_share.test.name}" - resource_group_name = "${azurerm_storage_share.test.resource_group_name}" storage_account_name = "${azurerm_storage_share.test.storage_account_name}" } `, template) @@ -381,7 +375,6 @@ func testAccAzureRMStorageShare_updateQuota(data acceptance.TestData) string { resource "azurerm_storage_share" "test" { name = "testshare%s" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" quota = 5 } diff --git a/azurerm/internal/services/storage/tests/resource_arm_storage_table_entity_test.go b/azurerm/internal/services/storage/tests/resource_arm_storage_table_entity_test.go index df29e6263cc5..8f31b96016a0 100644 --- a/azurerm/internal/services/storage/tests/resource_arm_storage_table_entity_test.go +++ b/azurerm/internal/services/storage/tests/resource_arm_storage_table_entity_test.go @@ -200,7 +200,7 @@ func testAccAzureRMTableEntity_requiresImport(data acceptance.TestData) string { return fmt.Sprintf(` %s -resource "azurerm_storage_table_entity" "test" { +resource "azurerm_storage_table_entity" "import" { storage_account_name = "${azurerm_storage_account.test.name}" table_name = "${azurerm_storage_table.test.name}" @@ -249,7 +249,6 @@ resource "azurerm_storage_account" "test" { resource "azurerm_storage_table" "test" { name = "acctestst%d" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger) diff --git a/azurerm/internal/services/storage/tests/resource_arm_storage_table_test.go b/azurerm/internal/services/storage/tests/resource_arm_storage_table_test.go index d07f2387d5b8..391decdc72dd 100644 --- a/azurerm/internal/services/storage/tests/resource_arm_storage_table_test.go +++ b/azurerm/internal/services/storage/tests/resource_arm_storage_table_test.go @@ -277,7 +277,6 @@ resource "azurerm_storage_account" "test" { resource "azurerm_storage_table" "test" { name = "acctestst%d" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger) @@ -290,7 +289,6 @@ func testAccAzureRMStorageTable_requiresImport(data acceptance.TestData) string resource "azurerm_storage_table" "import" { name = "${azurerm_storage_table.test.name}" - resource_group_name = "${azurerm_storage_table.test.resource_group_name}" storage_account_name = "${azurerm_storage_table.test.storage_account_name}" } `, template) @@ -317,7 +315,6 @@ resource "azurerm_storage_account" "test" { resource "azurerm_storage_table" "test" { name = "acctestst%d" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" acl { id = "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI" @@ -353,7 +350,6 @@ resource "azurerm_storage_account" "test" { resource "azurerm_storage_table" "test" { name = "acctestst%d" - resource_group_name = "${azurerm_resource_group.test.name}" storage_account_name = "${azurerm_storage_account.test.name}" acl { diff --git a/website/docs/r/storage_account.html.markdown b/website/docs/r/storage_account.html.markdown index 26a4619ad2f8..ff6179cdf6bb 100644 --- a/website/docs/r/storage_account.html.markdown +++ b/website/docs/r/storage_account.html.markdown @@ -105,10 +105,6 @@ The following arguments are supported: * `custom_domain` - (Optional) A `custom_domain` block as documented below. -* `enable_advanced_threat_protection` (Optional) Boolean flag which controls if advanced threat protection is enabled, see [here](https://docs.microsoft.com/en-us/azure/storage/common/storage-advanced-threat-protection) for more information. Defaults to `false`. - -~> **Note:** `enable_advanced_threat_protection` is not supported in all regions. - * `identity` - (Optional) A `identity` block as defined below. * `blob_properties` - (Optional) A `blob_properties` block as defined below. diff --git a/website/docs/r/storage_blob.html.markdown b/website/docs/r/storage_blob.html.markdown index 511f92eefe2b..9ab5f98f3759 100644 --- a/website/docs/r/storage_blob.html.markdown +++ b/website/docs/r/storage_blob.html.markdown @@ -35,7 +35,6 @@ resource "azurerm_storage_container" "example" { resource "azurerm_storage_blob" "example" { name = "my-awesome-content.zip" - resource_group_name = azurerm_resource_group.example.name storage_account_name = azurerm_storage_account.example.name storage_container_name = azurerm_storage_container.example.name type = "Block" @@ -75,10 +74,6 @@ The following arguments are supported: * `metadata` - (Optional) A map of custom blob metadata. -* `attempts` - (Optional / **Deprecated**) The number of attempts to make per page or block when uploading. Defaults to `1`. - -* `resource_group_name` - (Optional / **Deprecated**) The name of the resource group in which to create the storage container. - ## Attributes Reference The following attributes are exported in addition to the arguments listed above: diff --git a/website/docs/r/storage_container.html.markdown b/website/docs/r/storage_container.html.markdown index eddbca6ffccc..3600e019e173 100644 --- a/website/docs/r/storage_container.html.markdown +++ b/website/docs/r/storage_container.html.markdown @@ -32,7 +32,6 @@ resource "azurerm_storage_account" "example" { resource "azurerm_storage_container" "example" { name = "vhds" - resource_group_name = azurerm_resource_group.example.name storage_account_name = azurerm_storage_account.example.name container_access_type = "private" } @@ -50,8 +49,6 @@ The following arguments are supported: * `metadata` - (Optional) A mapping of MetaData for this Container. -* `resource_group_name` - (Optional / **Deprecated**) The name of the resource group in which to create the storage container. This field is no longer used and will be removed in 2.0. - ## Attributes Reference The following attributes are exported in addition to the arguments listed above: @@ -62,8 +59,6 @@ The following attributes are exported in addition to the arguments listed above: * `has_legal_hold` - Is there a Legal Hold configured on this Storage Container? -* `properties` - (**Deprecated**) Key-value definition of additional properties associated to the Storage Container - ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: diff --git a/website/docs/r/storage_queue.html.markdown b/website/docs/r/storage_queue.html.markdown index e4223e600f2f..06aee1e33cc7 100644 --- a/website/docs/r/storage_queue.html.markdown +++ b/website/docs/r/storage_queue.html.markdown @@ -28,7 +28,6 @@ resource "azurerm_storage_account" "example" { resource "azurerm_storage_queue" "example" { name = "mysamplequeue" - resource_group_name = azurerm_resource_group.example.name storage_account_name = azurerm_storage_account.example.name } ``` @@ -41,8 +40,6 @@ The following arguments are supported: * `storage_account_name` - (Required) Specifies the Storage Account in which the Storage Queue should exist. Changing this forces a new resource to be created. -* `resource_group_name` - (Optional / **Deprecated**) The name of the resource group in which to create the storage queue. - * `metadata` - (Optional) A mapping of MetaData which should be assigned to this Storage Queue. ## Attributes Reference diff --git a/website/docs/r/storage_share.html.markdown b/website/docs/r/storage_share.html.markdown index 49a593513ad3..fb8213835e31 100644 --- a/website/docs/r/storage_share.html.markdown +++ b/website/docs/r/storage_share.html.markdown @@ -48,9 +48,6 @@ The following arguments are supported: * `metadata` - (Optional) A mapping of MetaData for this File Share. -* `resource_group_name` - (Optional / **Deprecated**) The name of the resource group in which to - create the share. Changing this forces a new resource to be created. - --- A `acl` block supports the following: diff --git a/website/docs/r/storage_table.html.markdown b/website/docs/r/storage_table.html.markdown index 5107c08548ab..909864dfd0d8 100644 --- a/website/docs/r/storage_table.html.markdown +++ b/website/docs/r/storage_table.html.markdown @@ -28,7 +28,6 @@ resource "azurerm_storage_account" "example" { resource "azurerm_storage_table" "example" { name = "mysampletable" - resource_group_name = azurerm_resource_group.example.name storage_account_name = azurerm_storage_account.example.name } ``` @@ -42,8 +41,6 @@ The following arguments are supported: * `storage_account_name` - (Required) Specifies the storage account in which to create the storage table. Changing this forces a new resource to be created. -* `resource_group_name` - (Optional / **Deprecated**) The name of the resource group in which to create the storage table. - * `acl` - (Optional) One or more `acl` blocks as defined below. ---