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_blob_inventory_policy - add exclude_prefixes to filter resource block #20281

Merged
merged 2 commits into from
Feb 6, 2023
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 @@ -153,6 +153,17 @@ func storageBlobInventoryPolicyResourceSchema() map[string]*pluginsdk.Schema {
"prefix_match": {
Type: pluginsdk.TypeSet,
Optional: true,
MaxItems: 10,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
ValidateFunc: validation.StringIsNotEmpty,
},
},

"exclude_prefixes": {
Type: pluginsdk.TypeSet,
Optional: true,
MaxItems: 10,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
ValidateFunc: validation.StringIsNotEmpty,
Expand Down Expand Up @@ -287,6 +298,7 @@ func expandBlobInventoryPolicyFilter(input []interface{}) *storage.BlobInventory
v := input[0].(map[string]interface{})
return &storage.BlobInventoryPolicyFilter{
PrefixMatch: utils.ExpandStringSlice(v["prefix_match"].(*pluginsdk.Set).List()),
ExcludePrefix: utils.ExpandStringSlice(v["exclude_prefixes"].(*pluginsdk.Set).List()),
BlobTypes: utils.ExpandStringSlice(v["blob_types"].(*pluginsdk.Set).List()),
IncludeBlobVersions: utils.Bool(v["include_blob_versions"].(bool)),
IncludeDeleted: utils.Bool(v["include_deleted"].(bool)),
Expand Down Expand Up @@ -352,6 +364,7 @@ func flattenBlobInventoryPolicyFilter(input *storage.BlobInventoryPolicyFilter)
"include_deleted": includeDeleted,
"include_snapshots": includeSnapshots,
"prefix_match": utils.FlattenStringSlice(input.PrefixMatch),
"exclude_prefixes": utils.FlattenStringSlice(input.ExcludePrefix),
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ resource "azurerm_storage_blob_inventory_policy" "test" {
include_deleted = true
include_snapshots = true
prefix_match = ["*/test"]
exclude_prefixes = ["syslog.log"]
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion website/docs/r/storage_blob_inventory_policy.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ A `filter` block supports the following:

~> **NOTE**: The `rules.*.schema_fields` for this rule has to include `Snapshot` so that you can specify the `include_snapshots`.

* `prefix_match` - (Optional) A set of strings for blob prefixes to be matched.
* `prefix_match` - (Optional) A set of strings for blob prefixes to be matched. Maximum of 10 blob prefixes.

* `exclude_prefixes` - (Optional) A set of strings for blob prefixes to be excluded. Maximum of 10 blob prefixes.

---

Expand Down