Skip to content

Commit

Permalink
r/storage_account: support for BlockBlobStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Aug 21, 2019
1 parent 22262a2 commit 171503e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
1 change: 1 addition & 0 deletions azurerm/resource_arm_storage_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func resourceArmStorageAccount() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{
string(storage.Storage),
string(storage.BlobStorage),
string(storage.BlockBlobStorage),
string(storage.FileStorage),
string(storage.StorageV2),
}, true),
Expand Down
52 changes: 52 additions & 0 deletions azurerm/resource_arm_storage_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,35 @@ func TestAccAzureRMStorageAccount_blobStorageWithUpdate(t *testing.T) {
},
})
}

func TestAccAzureRMStorageAccount_blockBlobStorage(t *testing.T) {
resourceName := "azurerm_storage_account.testsa"
ri := tf.AccRandTimeInt()
rs := acctest.RandString(4)
location := testLocation()

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMStorageAccountDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMStorageAccount_blockBlobStorage(ri, rs, location),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMStorageAccountExists(resourceName),
resource.TestCheckResourceAttr("azurerm_storage_account.testsa", "account_kind", "BlockBlobStorage"),
resource.TestCheckResourceAttr("azurerm_storage_account.testsa", "access_tier", ""),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAzureRMStorageAccount_fileStorageWithUpdate(t *testing.T) {
resourceName := "azurerm_storage_account.testsa"
ri := tf.AccRandTimeInt()
Expand Down Expand Up @@ -1099,6 +1128,29 @@ resource "azurerm_storage_account" "testsa" {
`, rInt, location, rString)
}

func testAccAzureRMStorageAccount_blockBlobStorage(rInt int, rString string, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "testrg" {
name = "acctestAzureRMSA-%d"
location = "%s"
}
resource "azurerm_storage_account" "testsa" {
name = "unlikely23exst2acct%s"
resource_group_name = "${azurerm_resource_group.testrg.name}"
location = "${azurerm_resource_group.testrg.location}"
account_kind = "BlockBlobStorage"
account_tier = "Premium"
account_replication_type = "LRS"
tags = {
environment = "production"
}
}
`, rInt, location, rString)
}

func testAccAzureRMStorageAccount_fileStorage(rInt int, rString string, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "testrg" {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/storage_account.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ The following arguments are supported:

* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

* `account_kind` - (Optional) Defines the Kind of account. Valid options are `Storage`, `StorageV2`, `BlobStorage`, and `FileStorage`. Changing this forces a new resource to be created. Defaults to `Storage`.
* `account_kind` - (Optional) Defines the Kind of account. Valid options are `BlobStorage`, `BlockBlobStorage`, `FileStorage`, `Storage` and `StorageV2`. Changing this forces a new resource to be created. Defaults to `Storage`.

* `account_tier` - (Required) Defines the Tier to use for this storage account. Valid options are `Standard` and `Premium`. For `FileStorage` accounts only `Premium` is valid. Changing this forces a new resource to be created.

Expand Down

0 comments on commit 171503e

Please sign in to comment.