Interval and Interval_unit with aws_dlm_lifecycle_policy

Hi everyone,

I am implementing some Data Lifecycle Manager policies within my AWS estate via terraform. Some of the the snapshot policies have the requirement to take an EC2 snapshot every 1 week for example and retain 3 snapshots (via a Tag 7/3). However I can see in the latest terraform docs (https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/dlm_lifecycle_policy) currently terraform only allows snapshot interval values and an interval unit of the below:

  • interval (Required) How often this lifecycle policy should be evaluated. 1 , 2 , 3 , 4 , 6 , 8 , 12 or 24 are valid values.
  • interval_unit - (Optional) The unit for how often the lifecycle policy should be evaluated. HOURS is currently the only allowed value and also the default value.

Therefore it is seemingly impossible to implement a snapshot policy through terraform with my above requirement. Does anyone know a way around this (I know I can create it in the AWS console directly) or if terraform plan to incorporate additional values for the interval and interval_unit parameters in the future?

Thanks.

I have same problem. Have you found any solutions to specifying weekly, monthly schedules via terraform? Thanks!

Indeed there are a few issues open on Github in regards to improving the interval of this resource. Especially a cron based approach might help you.
An intermediate solution could be using a CloudFormation template and deploy it using terraform.