Skip to content

Commit

Permalink
azurerm_storage_share - set metadata to Computed and set acl
Browse files Browse the repository at this point in the history
…`start` and `expiry` to `Optional` (#8811)
  • Loading branch information
yupwei68 authored Oct 12, 2020
1 parent a64af5d commit 3577636
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func resourceArmStorageShare() *schema.Resource {
ValidateFunc: validation.IntBetween(1, 102400),
},

"metadata": MetaDataSchema(),
"metadata": MetaDataComputedSchema(),

"acl": {
Type: schema.TypeSet,
Expand All @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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(`
Expand Down
6 changes: 3 additions & 3 deletions website/docs/r/storage_share.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3577636

Please sign in to comment.