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

azurerm_storage_account - allow up to 50 tags #5934

Merged
merged 2 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 2 additions & 10 deletions azurerm/internal/services/storage/resource_arm_storage_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,6 @@ func resourceArmStorageAccount() *schema.Resource {
},
},

"tags": {
Type: schema.TypeMap,
Optional: true,
Computed: true,
ValidateFunc: validateAzureRMStorageAccountTags,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},

"blob_properties": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -543,6 +533,8 @@ func resourceArmStorageAccount() *schema.Resource {
Computed: true,
Sensitive: true,
},

"tags": tags.Schema(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storage account tags are still more limited (length) than other resources, we might want to add a specific schema to the tags package that still uses validateAzureRMStorageAccountTags and update that to the 50 count?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, good catch! thx

},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,25 @@ func TestAccAzureRMStorageAccount_requiresImport(t *testing.T) {
})
}

func TestAccAzureRMStorageAccount_tagCount(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_tagCount(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMStorageAccountExists(data.ResourceName),
),
},
data.ImportStep(),
},
})
}

func TestAccAzureRMStorageAccount_writeLock(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_storage_account", "test")

Expand Down Expand Up @@ -671,6 +690,37 @@ resource "azurerm_storage_account" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomString)
}

func testAccAzureRMStorageAccount_tagCount(data acceptance.TestData) string {
tags := ""
for i := 0; i < 50; i++ {
tags += fmt.Sprintf("t%d = \"v%d\"\n", i, i)
}

return fmt.Sprintf(`
provider "azurerm" {
features {}
}

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"

tags = {
%s
}
}
`, data.RandomInteger, data.Locations.Primary, data.RandomString, tags)
}

func testAccAzureRMStorageAccount_requiresImport(data acceptance.TestData) string {
template := testAccAzureRMStorageAccount_basic(data)
return fmt.Sprintf(`
Expand Down