From 23241a7565aec0d141988cb9251207dc9dd8f835 Mon Sep 17 00:00:00 2001 From: Hauke Brandt Date: Fri, 19 Jul 2024 09:03:29 +0200 Subject: [PATCH] feat: Examples now include storage management policy --- examples/apply_main.tf | 41 +++++++++++++++++++++++++++++++++++++++++ examples/full_main.tf | 36 ++++++++++++++++++++++++++++++++++++ examples/min_main.tf | 17 +++++++++++++++++ 3 files changed, 94 insertions(+) diff --git a/examples/apply_main.tf b/examples/apply_main.tf index b28fc07..1fef039 100644 --- a/examples/apply_main.tf +++ b/examples/apply_main.tf @@ -27,6 +27,47 @@ module "storage" { ip_rules = ["172.0.0.2"] virtual_network_subnet_ids = [module.network.subnet["snet-app-mms"].id] } + blob_properties = { + last_access_time_enabled = true + } + tags = { + project = "mms-github" + environment = terraform.workspace + managed-by = "terraform" + } + } + } + storage_management_policy = { + policy = { + storage_account_id = module.storage.storage_account.stmms.id + rule = { + rule1 = { + filters = { + blob_types = ["blockBlob"] + prefix_match = ["terraform"] + match_blob_index_tag = { + name = "project" + value = "mms-github" + operation = "==" + } + } + actions = { + base_blob = { + tier_to_cool_after_days_since_last_access_time_greater_than = 7 + auto_tier_to_hot_from_cool_enabled = true + tier_to_cold_after_days_since_modification_greater_than = 30 + } + snapshot = { + tier_to_archive_after_days_since_last_tier_change_greater_than = 60 + delete_after_days_since_creation_greater_than = 180 + } + version = { + tier_to_cold_after_days_since_creation_greater_than = 30 + delete_after_days_since_creation = 90 + } + } + } + } } } storage_container = { diff --git a/examples/full_main.tf b/examples/full_main.tf index 799a573..1fef039 100644 --- a/examples/full_main.tf +++ b/examples/full_main.tf @@ -27,6 +27,9 @@ module "storage" { ip_rules = ["172.0.0.2"] virtual_network_subnet_ids = [module.network.subnet["snet-app-mms"].id] } + blob_properties = { + last_access_time_enabled = true + } tags = { project = "mms-github" environment = terraform.workspace @@ -34,6 +37,39 @@ module "storage" { } } } + storage_management_policy = { + policy = { + storage_account_id = module.storage.storage_account.stmms.id + rule = { + rule1 = { + filters = { + blob_types = ["blockBlob"] + prefix_match = ["terraform"] + match_blob_index_tag = { + name = "project" + value = "mms-github" + operation = "==" + } + } + actions = { + base_blob = { + tier_to_cool_after_days_since_last_access_time_greater_than = 7 + auto_tier_to_hot_from_cool_enabled = true + tier_to_cold_after_days_since_modification_greater_than = 30 + } + snapshot = { + tier_to_archive_after_days_since_last_tier_change_greater_than = 60 + delete_after_days_since_creation_greater_than = 180 + } + version = { + tier_to_cold_after_days_since_creation_greater_than = 30 + delete_after_days_since_creation = 90 + } + } + } + } + } + } storage_container = { terraform = { storage_account_name = module.storage.storage_account["stmms"].name diff --git a/examples/min_main.tf b/examples/min_main.tf index 7f6825a..0c9d460 100644 --- a/examples/min_main.tf +++ b/examples/min_main.tf @@ -6,6 +6,23 @@ module "storage" { resource_group_name = "rg-mms-github" } } + storage_management_policy = { + policy = { + storage_account_id = module.storage.storage_account.stmms.id + rule = { + rule1 = { + filters = { + blob_types = ["blockBlob"] + } + actions = { + base_blob = { + delete_after_days_since_modification_greater_than = 7 + } + } + } + } + } + } storage_container = { terraform = { storage_account_name = module.storage.storage_account["stmms"].name