From a9cd478003f6e092076115b35aec993a9ee7275b Mon Sep 17 00:00:00 2001 From: yupwei68 Date: Fri, 9 Oct 2020 10:21:18 +0800 Subject: [PATCH 1/4] update --- azurerm/internal/services/storage/metadata.go | 1 + .../internal/services/storage/resource_arm_storage_share.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/azurerm/internal/services/storage/metadata.go b/azurerm/internal/services/storage/metadata.go index a133c4d242d6..8c45480bb12c 100644 --- a/azurerm/internal/services/storage/metadata.go +++ b/azurerm/internal/services/storage/metadata.go @@ -12,6 +12,7 @@ func MetaDataSchema() *schema.Schema { return &schema.Schema{ Type: schema.TypeMap, Optional: true, + Computed: true, ValidateFunc: ValidateMetaDataKeys, Elem: &schema.Schema{ Type: schema.TypeString, diff --git a/azurerm/internal/services/storage/resource_arm_storage_share.go b/azurerm/internal/services/storage/resource_arm_storage_share.go index 259316455c01..32cef3abbb6a 100644 --- a/azurerm/internal/services/storage/resource_arm_storage_share.go +++ b/azurerm/internal/services/storage/resource_arm_storage_share.go @@ -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": { From 4462b2ed578cf72fbf929e3791f103a7f99c034c Mon Sep 17 00:00:00 2001 From: yupwei68 Date: Fri, 9 Oct 2020 10:48:52 +0800 Subject: [PATCH 2/4] update --- azurerm/internal/services/storage/metadata.go | 1 - azurerm/internal/services/storage/resource_arm_storage_share.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/azurerm/internal/services/storage/metadata.go b/azurerm/internal/services/storage/metadata.go index 8c45480bb12c..a133c4d242d6 100644 --- a/azurerm/internal/services/storage/metadata.go +++ b/azurerm/internal/services/storage/metadata.go @@ -12,7 +12,6 @@ func MetaDataSchema() *schema.Schema { return &schema.Schema{ Type: schema.TypeMap, Optional: true, - Computed: true, ValidateFunc: ValidateMetaDataKeys, Elem: &schema.Schema{ Type: schema.TypeString, diff --git a/azurerm/internal/services/storage/resource_arm_storage_share.go b/azurerm/internal/services/storage/resource_arm_storage_share.go index 32cef3abbb6a..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, From ec385acc9c8a78db1d8c6fedf1bcd9f1e8e409fe Mon Sep 17 00:00:00 2001 From: yupwei68 Date: Sat, 10 Oct 2020 16:56:17 +0800 Subject: [PATCH 3/4] r1 --- .../tests/resource_arm_storage_share_test.go | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) 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(` From 06115f62fde9e6c3db018c02ec35e98171a2083f Mon Sep 17 00:00:00 2001 From: Matthew Frahry Date: Mon, 12 Oct 2020 14:16:44 -0700 Subject: [PATCH 4/4] Update storage_share.html.markdown --- website/docs/r/storage_share.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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