ebs_backups.tf 859 B

123456789101112131415161718192021222324252627282930313233343536
  1. # To keep in line with FedRAMP we are setting up a lifecycle on the EBS vol to create "backups"
  2. # It will target the tag "Snapshot" based on the value depends on what policy is assigned (see comments bellow)
  3. resource "aws_dlm_lifecycle_policy" "daily" {
  4. description = "daily DLM lifecycle policy"
  5. execution_role_arn = aws_iam_role.dlm_lifecycle_role.arn
  6. state = "ENABLED"
  7. policy_details {
  8. resource_types = ["VOLUME"]
  9. schedule {
  10. name = "daily snapshots retain 2"
  11. create_rule {
  12. interval = 24
  13. interval_unit = "HOURS"
  14. times = ["23:45"]
  15. }
  16. retain_rule {
  17. count = 2
  18. }
  19. tags_to_add = {
  20. SnapshotCreator = "DLM"
  21. SnapshotPolicy = "Daily"
  22. }
  23. copy_tags = true
  24. }
  25. target_tags = {
  26. Snapshot = "Daily"
  27. }
  28. }
  29. }