So I'm using terraform for azure provider in order to deploy my infrastructure. I just can't seem to be able to define the storage lifecycle. I'd like to add something like this, which i have found, but is not available as is.
So i've tried this https://github.com/terraform-providers/terraform-provider-azurerm/issues/3316, and i've look all over. I'm certain there's a way of telling azure to enable the lifecycle tiertoarchive and tiertodelete… Just can't seem to figure it out.
Thanks
What i'm looking for:
*the resource azurerm_storage_management_policy is a made up resource.
resource "azurerm_storage_account" "example" {
name = "myaccount"
resource_group_name = "myresourcegroup"
location = "westeurope"
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_storage_management_policy" "example" {
storage_account_name ="${azurerm_storage_account.example.name}"
rule {
name = "rule1"
enabled = true
type = "Lifecycle"
definition {
filters {
prefix_match = ["container1/wibble"]
blob_types = ["blockBlob"]
}
actions = {
base_blob {
tier_to_cool {
days_after_modification_greater_than = 30
}
tier_to_archive {
days_after_modification_greater_than = 90
}
delete {
days_after_modification_greater_than = 2555
}
snapshot {
delete {
days_after_creation_greater_than = 90
}
}
}
}
}
}
https://github.com/terraform-providers/terraform-provider-azurerm/issues/3316