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

New features in azurerm_storage_management_policy #11163

Merged
merged 33 commits into from
Apr 27, 2021
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 @@ -53,6 +53,29 @@ func dataSourceStorageManagementPolicy() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},

"match_blob_index_tag": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this another "not yet in global property?"

------- Stdout: -------
=== RUN   TestAccStorageManagementPolicy_blobIndexMatch
=== PAUSE TestAccStorageManagementPolicy_blobIndexMatch
=== CONT  TestAccStorageManagementPolicy_blobIndexMatch
    testing.go:620: Step 3/6 error: Error running apply: exit status 1
        
        Error: creating Azure Storage Management Policy "/subscriptions/*******/resourceGroups/acctestRG-storage-210426173350412751/providers/Microsoft.Storage/storageAccounts/unlikely23exst2acctu9ru0": storage.ManagementPoliciesClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="FeatureNotSupportedForAccount" Message="Tag based filtering is not supported for the account."
        
          on terraform_plugin_test.tf line 30, in resource "azurerm_storage_management_policy" "test":
          30: resource "azurerm_storage_management_policy" "test" {
        
--- FAIL: TestAccStorageManagementPolicy_blobIndexMatch (212.08s)
FAIL

------- Stderr: -------
2021/04/26 17:33:49 [DEBUG] not using binary driver name, it's no longer needed
2021/04/26 17:33:50 [DEBUG] not using binary driver name, it's no longer needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},

"operation": {
Type: schema.TypeString,
Computed: true,
},

"value": {
Type: schema.TypeString,
Computed: true,
},
},
},
},
},
},
},
Expand Down Expand Up @@ -86,13 +109,42 @@ func dataSourceStorageManagementPolicy() *schema.Resource {
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"change_tier_to_archive_after_days_since_creation": {
Type: schema.TypeInt,
Computed: true,
},
"change_tier_to_cool_after_days_since_creation": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"delete_after_days_since_creation_greater_than": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
"version": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"change_tier_to_archive_after_days_since_creation": {
Type: schema.TypeInt,
Computed: true,
},
"change_tier_to_cool_after_days_since_creation": {
Type: schema.TypeInt,
Computed: true,
},
"delete_after_days_since_creation": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
},
},
},
Expand Down Expand Up @@ -123,11 +175,10 @@ func dataSourceStorageManagementPolicyRead(d *schema.ResourceData, meta interfac
}
d.SetId(*result.ID)

if result.Policy != nil {
policy := result.Policy
if policy.Rules != nil {
if props := result.ManagementPolicyProperties; props != nil {
if policy := props.Policy; policy != nil {
if err := d.Set("rule", flattenStorageManagementPolicyRules(policy.Rules)); err != nil {
return fmt.Errorf("Error flattening `rule`: %+v", err)
return fmt.Errorf("flattening `rule`: %+v", err)
}
}
}
Expand Down
Loading