diff --git a/azurerm/internal/services/storage/resource_arm_storage_share.go b/azurerm/internal/services/storage/resource_arm_storage_share.go index 259316455c01..78a0b9ad10f2 100644 --- a/azurerm/internal/services/storage/resource_arm_storage_share.go +++ b/azurerm/internal/services/storage/resource_arm_storage_share.go @@ -69,7 +69,7 @@ func resourceArmStorageShare() *schema.Resource { ValidateFunc: validation.IntBetween(1, 102400), }, - "metadata": MetaDataSchema(), + "metadata": MetaDataComputedSchema(), "acl": { Type: schema.TypeSet, @@ -88,12 +88,12 @@ func resourceArmStorageShare() *schema.Resource { Schema: map[string]*schema.Schema{ "start": { Type: schema.TypeString, - Required: true, + Optional: true, ValidateFunc: validation.StringIsNotEmpty, }, "expiry": { Type: schema.TypeString, - Required: true, + Optional: true, ValidateFunc: validation.StringIsNotEmpty, }, "permissions": { 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 59eb2f4d20a5..bcc10a965aac 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 @@ -152,6 +152,25 @@ func TestAccAzureRMStorageShare_acl(t *testing.T) { }) } +func TestAccAzureRMStorageShare_aclGhostedRecall(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_storage_share", "test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.PreCheck(t) }, + Providers: acceptance.SupportedProviders, + CheckDestroy: testCheckAzureRMStorageShareDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMStorageShare_aclGhostedRecall(data), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageShareExists(data.ResourceName), + ), + }, + data.ImportStep(), + }, + }) +} + func TestAccAzureRMStorageShare_updateQuota(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_storage_share", "test") @@ -376,6 +395,25 @@ resource "azurerm_storage_share" "test" { `, template, data.RandomString) } +func testAccAzureRMStorageShare_aclGhostedRecall(data acceptance.TestData) string { + template := testAccAzureRMStorageShare_template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_storage_share" "test" { + name = "testshare%s" + storage_account_name = azurerm_storage_account.test.name + + acl { + id = "GhostedRecall" + access_policy { + permissions = "r" + } + } +} +`, template, data.RandomString) +} + func testAccAzureRMStorageShare_aclUpdated(data acceptance.TestData) string { template := testAccAzureRMStorageShare_template(data) return fmt.Sprintf(` diff --git a/website/docs/r/storage_share.html.markdown b/website/docs/r/storage_share.html.markdown index c3a8faee52ad..2f224c954911 100644 --- a/website/docs/r/storage_share.html.markdown +++ b/website/docs/r/storage_share.html.markdown @@ -72,13 +72,13 @@ A `acl` block supports the following: A `access_policy` block supports the following: -* `expiry` - (Required) The time at which this Access Policy should be valid until, in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) format. - * `permissions` - (Required) The permissions which should be associated with this Shared Identifier. Possible value is combination of `r` (read), `w` (write), `d` (delete), and `l` (list). ~> **Note:** Permission order is strict at the service side, and permissions need to be listed in the order above. -* `start` - (Required) The time at which this Access Policy should be valid from, in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) format. +* `start` - (Optional) The time at which this Access Policy should be valid from, in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) format. + +* `expiry` - (Optional) The time at which this Access Policy should be valid until, in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) format. ## Attributes Reference