I am trying to assign Storage account lifecycle management policy using terraform. The lists of more than 30 containers are defined in the input.tfvars file as lists of strings. “resource azurerm_storage_management_policy lifecycle” code is given below. But it is giving error as ManagementPolicy rule Rule1 is invalid.Too many prefixMatch. How do I resolve it.
The code details in my git is given below.
input.tfvars –
containername = ["a", "b", "c", "d", "e", "f", "g".................................]
This list includes more than 30 container names.
variables.tf —
variable "containername" {
type = list(string)
default = []
}
main.tf —
locals {
folderlist1 = ["a", "b", "c", "d", "e", "f", "g"................................30+ container_names...]
list1 = [ for a in local.folderlist1: a ]
}
output "result1" {
value = local.list1
}
resource "azurerm_storage_management_policy" "lifecycle" {
storage_account_id = azurerm_storage_account.sa.id
rule{
name = "Rule1"
enabled = true
filters {
prefix_match = local.list1
blob_types = ["blockBlob"]
}
actions {
base_blob {
delete_after_days_since_modification_greater_than = 15
}
snapshot {
delete_after_days_since_creation_greater_than = 15
}
}
}
}
Giving error as ManagementPolicy rule Rule1 is invalid. Too many prefixMatch