AWS Lifecycle Manager allows the creation of "VariableTags" when creating a snapshot. This currently doesn't appear to be available and would be helpful.
resource "aws_dlm_lifecycle_policy" "example" {
description = "example DLM lifecycle policy"
execution_role_arn = "${aws_iam_role.dlm_lifecycle_role.arn}"
state = "ENABLED"
policy_details {
resource_types = ["VOLUME"]
schedule {
name = "2 weeks of daily snapshots"
create_rule {
interval = 24
interval_unit = "HOURS"
times = ["23:45"]
}
retain_rule {
count = 14
}
tags_to_add = {
SnapshotCreator = "DLM"
}
variable_tags = {
instance_id = "$(instance-id)"
timestamp = "$(timestamp)"
}
copy_tags = false
}
target_tags = {
Snapshot = "true"
}
}
}
https://docs.aws.amazon.com/cli/latest/reference/dlm/create-lifecycle-policy.html
https://docs.aws.amazon.com/dlm/latest/APIReference/API_Schedule.html
Docs above state that variable_tags
is supported only when the resource_type is INSTANCE
.
And the current terraform docs say that :
resource_types - (Required) A list of resource types that should be targeted by the lifecycle policy. VOLUME is currently the only allowed value.
This is not entirely true.
I had no issue using INSTANCE right now (v2.26.0) but variable_tags
is indeed missing.
I've raised #14348 based on the syntax above. Happy to change it to support a different syntax if there's a preference.
Most helpful comment
https://docs.aws.amazon.com/dlm/latest/APIReference/API_Schedule.html
Docs above state that
variable_tags
is supported only when the resource_type isINSTANCE
.And the current terraform docs say that :
This is not entirely true.
I had no issue using INSTANCE right now (v2.26.0) but
variable_tags
is indeed missing.