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

Updated storage management policy module #2083

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ azuread_applications = {
admin_consent_description = "Allow to administer app2."
admin_consent_display_name = "Administer app2"
enabled = true
type = "Admin"
value = "app2"
type = "Admin"
value = "app2"
}
]
}
Expand Down
26 changes: 19 additions & 7 deletions modules/storage_account/management_policy/management_policy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,45 @@ resource "azurerm_storage_management_policy" "mgmt_policy" {
content {
tier_to_cool_after_days_since_modification_greater_than = try(base_blob.value.tier_to_cool_after_days_since_modification_greater_than, null)
tier_to_cool_after_days_since_last_access_time_greater_than = try(base_blob.value.tier_to_cool_after_days_since_last_access_time_greater_than, null)
tier_to_cool_after_days_since_creation_greater_than = try(base_blob.value.tier_to_cool_after_days_since_creation_greater_than, null)
auto_tier_to_hot_from_cool_enabled = try(base_blob.value.auto_tier_to_hot_from_cool_enabled, null)
tier_to_archive_after_days_since_modification_greater_than = try(base_blob.value.tier_to_archive_after_days_since_modification_greater_than, null)
tier_to_archive_after_days_since_last_access_time_greater_than = try(base_blob.value.tier_to_archive_after_days_since_last_access_time_greater_than, null)
tier_to_archive_after_days_since_creation_greater_than = try(base_blob.value.tier_to_archive_after_days_since_creation_greater_than, null)
tier_to_archive_after_days_since_last_tier_change_greater_than = try(base_blob.value.tier_to_archive_after_days_since_last_tier_change_greater_than, null)
tier_to_cold_after_days_since_modification_greater_than = try(base_blob.value.tier_to_cold_after_days_since_modification_greater_than, null)
tier_to_cold_after_days_since_last_access_time_greater_than = try(base_blob.value.tier_to_cold_after_days_since_last_access_time_greater_than, null)
tier_to_cold_after_days_since_creation_greater_than = try(base_blob.value.tier_to_cold_after_days_since_creation_greater_than, null)
delete_after_days_since_modification_greater_than = try(base_blob.value.delete_after_days_since_modification_greater_than, null)
delete_after_days_since_last_access_time_greater_than = try(base_blob.value.delete_after_days_since_last_access_time_greater_than, null)
delete_after_days_since_creation_greater_than = try(base_blob.value.delete_after_days_since_creation_greater_than, null)
}
}

dynamic "snapshot" {
for_each = try(rule.value.actions.snapshot, {})

content {
change_tier_to_archive_after_days_since_creation = try(snapshot.value.change_tier_to_archive_after_days_since_creation, null)
change_tier_to_cool_after_days_since_creation = try(snapshot.value.change_tier_to_cool_after_days_since_creation, null)
delete_after_days_since_creation_greater_than = try(snapshot.value.delete_after_days_since_creation_greater_than, null)
change_tier_to_archive_after_days_since_creation = try(snapshot.value.change_tier_to_archive_after_days_since_creation, null)
tier_to_archive_after_days_since_last_tier_change_greater_than = try(snapshot.value.tier_to_archive_after_days_since_last_tier_change_greater_than, null)
change_tier_to_cool_after_days_since_creation = try(snapshot.value.change_tier_to_cool_after_days_since_creation, null)
tier_to_cold_after_days_since_creation_greater_than = try(snapshot.value.tier_to_cold_after_days_since_creation_greater_than, null)
delete_after_days_since_creation_greater_than = try(snapshot.value.delete_after_days_since_creation_greater_than, null)
}
}

dynamic "version" {
for_each = try(rule.value.actions.version, {})

content {
change_tier_to_archive_after_days_since_creation = try(version.value.change_tier_to_archive_after_days_since_creation, null)
change_tier_to_cool_after_days_since_creation = try(version.value.change_tier_to_cool_after_days_since_creation, null)
delete_after_days_since_creation = try(version.value.delete_after_days_since_creation, null)
change_tier_to_archive_after_days_since_creation = try(version.value.change_tier_to_archive_after_days_since_creation, null)
tier_to_archive_after_days_since_last_tier_change_greater_than = try(version.value.tier_to_archive_after_days_since_last_tier_change_greater_than, null)
change_tier_to_cool_after_days_since_creation = try(version.value.change_tier_to_cool_after_days_since_creation, null)
tier_to_cold_after_days_since_creation_greater_than = try(version.value.tier_to_cold_after_days_since_creation_greater_than, null)
delete_after_days_since_creation = try(version.value.delete_after_days_since_creation, null)
}
}
}
}
}
}
}