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_share set metadata Computed and set acl start and expiry Optional #8811

Merged
merged 4 commits into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
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