我遵循了 Terraform 文档,其中提到了启用存储保留策略(包括容器/文件夹)的代码 - https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_management_policy
但是如何为除一个容器文件夹之外的所有容器启用存储保留策略。我不希望删除此特定容器 1/文件夹 1 下的数据。 我使用了语法 prefix_match != ["container1/folder1", "container2/folder2"],但它不起作用。
storage_account_id = azurerm_storage_account.example.id
rule {
name = "rule2"
enabled = true
filters {
prefix_match != ["container1/folder1", "container2/folder2"]
blob_types = ["blockBlob"]
}
actions {
base_blob {
tier_to_cool_after_days_since_modification_greater_than = 11
tier_to_archive_after_days_since_modification_greater_than = 51
delete_after_days_since_modification_greater_than = 101
}
snapshot {
change_tier_to_archive_after_days_since_creation = 90
change_tier_to_cool_after_days_since_creation = 23
delete_after_days_since_creation_greater_than = 31
}
version {
change_tier_to_archive_after_days_since_creation = 9
change_tier_to_cool_after_days_since_creation = 90
delete_after_days_since_creation = 3
}
}
}
}````
How do I enable storage retention policy for All containers but EXCLUDING one container folder. I do not want the data to get deleted under this specific container1/folder1.
I have used the Syntax prefix_match != ["container1/folder1", "container2/folder2"], But it is not working.
不幸的是,我认为这是不可能的。 文档指定它忽略
!=
。
前缀匹配仅考虑正(=)逻辑比较。负 (!=) 逻辑比较将被忽略。
我会推荐给任何一个