Skip to content

Commit

Permalink
Data source: azurerm_storage_management_policy add supports for the…
Browse files Browse the repository at this point in the history
… `tier_to_archive_after_days_since_last_tier_change_greater_than` (#18898)
  • Loading branch information
magodo authored Oct 21, 2022
1 parent 998910d commit 779963d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
12 changes: 12 additions & 0 deletions internal/services/storage/storage_management_policy_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ func dataSourceStorageManagementPolicy() *pluginsdk.Resource {
Type: pluginsdk.TypeInt,
Computed: true,
},
"tier_to_archive_after_days_since_last_tier_change_greater_than": {
Type: pluginsdk.TypeInt,
Computed: true,
},
"delete_after_days_since_last_access_time_greater_than": {
Type: pluginsdk.TypeInt,
Computed: true,
Expand All @@ -126,6 +130,10 @@ func dataSourceStorageManagementPolicy() *pluginsdk.Resource {
Type: pluginsdk.TypeInt,
Computed: true,
},
"tier_to_archive_after_days_since_last_tier_change_greater_than": {
Type: pluginsdk.TypeInt,
Computed: true,
},
"change_tier_to_cool_after_days_since_creation": {
Type: pluginsdk.TypeInt,
Optional: true,
Expand All @@ -147,6 +155,10 @@ func dataSourceStorageManagementPolicy() *pluginsdk.Resource {
Type: pluginsdk.TypeInt,
Computed: true,
},
"tier_to_archive_after_days_since_last_tier_change_greater_than": {
Type: pluginsdk.TypeInt,
Computed: true,
},
"change_tier_to_cool_after_days_since_creation": {
Type: pluginsdk.TypeInt,
Computed: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ func TestAccDataSourceStorageManagementPolicy_basic(t *testing.T) {
check.That(data.ResourceName).Key("rule.0.actions.0.base_blob.#").HasValue("1"),
check.That(data.ResourceName).Key("rule.0.actions.0.base_blob.0.tier_to_cool_after_days_since_modification_greater_than").HasValue("10"),
check.That(data.ResourceName).Key("rule.0.actions.0.base_blob.0.tier_to_archive_after_days_since_modification_greater_than").HasValue("50"),
check.That(data.ResourceName).Key("rule.0.actions.0.base_blob.0.tier_to_archive_after_days_since_last_tier_change_greater_than").HasValue("10"),
check.That(data.ResourceName).Key("rule.0.actions.0.base_blob.0.delete_after_days_since_modification_greater_than").HasValue("100"),
check.That(data.ResourceName).Key("rule.0.actions.0.snapshot.#").HasValue("1"),
check.That(data.ResourceName).Key("rule.0.actions.0.snapshot.0.delete_after_days_since_creation_greater_than").HasValue("30"),
check.That(data.ResourceName).Key("rule.0.actions.0.snapshot.0.tier_to_archive_after_days_since_last_tier_change_greater_than").HasValue("10"),
check.That(data.ResourceName).Key("rule.0.actions.0.snapshot.0.change_tier_to_archive_after_days_since_creation").HasValue("10"),
),
},
})
Expand Down Expand Up @@ -91,12 +94,15 @@ resource "azurerm_storage_management_policy" "test" {
}
actions {
base_blob {
tier_to_cool_after_days_since_modification_greater_than = 10
tier_to_archive_after_days_since_modification_greater_than = 50
delete_after_days_since_modification_greater_than = 100
tier_to_cool_after_days_since_modification_greater_than = 10
tier_to_archive_after_days_since_modification_greater_than = 50
tier_to_archive_after_days_since_last_tier_change_greater_than = 10
delete_after_days_since_modification_greater_than = 100
}
snapshot {
delete_after_days_since_creation_greater_than = 30
delete_after_days_since_creation_greater_than = 30
change_tier_to_archive_after_days_since_creation = 10
tier_to_archive_after_days_since_last_tier_change_greater_than = 10
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions website/docs/d/storage_management_policy.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ The following arguments are supported:
* `tier_to_cool_after_days_since_last_access_time_greater_than` - The age in days after last access time to tier blobs to cool storage. Supports blob currently at Hot tier.
* `tier_to_archive_after_days_since_modification_greater_than` - The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.
* `tier_to_archive_after_days_since_last_access_time_greater_than` - The age in days after last access time to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.
* `tier_to_archive_after_days_since_last_tier_change_greater_than` - The age in days after last tier change to the blobs to skip to be archved.
* `delete_after_days_since_modification_greater_than` - The age in days after last modification to delete the blob.
* `delete_after_days_since_last_access_time_greater_than` - The age in days after last access time to delete the blob.

Expand All @@ -75,6 +76,7 @@ The following arguments are supported:
`snapshot` supports the following:

* `change_tier_to_archive_after_days_since_creation` - The age in days after creation to tier blob snapshot to archive storage.
* `tier_to_archive_after_days_since_last_tier_change_greater_than` - The age in days after last tier change to the blobs to skip to be archved.
* `change_tier_to_cool_after_days_since_creation` - The age in days after creation to tier blob snapshot to cool storage.
* `delete_after_days_since_creation_greater_than` - The age in days after creation to delete the blob snapshot.

Expand All @@ -83,6 +85,7 @@ The following arguments are supported:
`version` supports the following:

* `change_tier_to_archive_after_days_since_creation` - The age in days after creation to tier blob version to archive storage.
* `tier_to_archive_after_days_since_last_tier_change_greater_than` - The age in days after last tier change to the blobs to skip to be archved.
* `change_tier_to_cool_after_days_since_creation` - The age in days after creation to tier blob version to cool storage.
* `delete_after_days_since_creation` - The age in days after creation to delete the blob version.

Expand Down

0 comments on commit 779963d

Please sign in to comment.