hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.18k forks source link

[Enhancement]: aws_dlm_lifecycle_policy has no option to exclude volumes by tag #27110

Open codybswaney opened 2 years ago

codybswaney commented 2 years ago

Description

In the AWS console and through the CLI, you can exclude specific data volumes by tag whenever you create a DLM lifecycle that targets instances rather than volumes.

Screen Shot 2022-10-05 at 9 19 20 AM

However, there seems to be no such way to do that with the aws_dlm_lifecycle_policy resource, and importing in a policy with such configuration has no mention of volume exclusion.

Affected Resource(s) and/or Data Source(s)

aws_dlm_lifecycle_policy

Potential Terraform Configuration

resource "aws_dlm_lifecycle_policy" "example" {
  description        = "Example Policy"
  execution_role_arn = "arn:aws:iam::123456789:role/dlm-lifecycle-role"
  tags               = {}
  tags_all           = {}

  policy_details {
    policy_type        = "EBS_SNAPSHOT_MANAGEMENT"
    resource_locations = [
      "CLOUD",
    ]
    resource_types     = [
      "INSTANCE",
    ]
    target_tags        = {
      "snapshot" = "true"
    }

    parameters {
      exclude_boot_volume = false
      no_reboot           = false

      // Here is the suggested addition to exclude volumes by tag.
      // Named after the CLI option.
      exclude_data_volume_tags = {
          "purpose" = "example"
      }
    }

    schedule {
      copy_tags     = false
      name          = "Nightly"
      tags_to_add   = {}
      variable_tags = {
        "instance-id" = "$(instance-id)"
        "timestamp"   = "$(timestamp)"
      }

      create_rule {
        interval      = 24
        interval_unit = "HOURS"
        location      = "CLOUD"
        times         = [
          "03:00",
        ]
      }

      retain_rule {
        count    = 30
      }
    }
  }
}

References

https://docs.aws.amazon.com/cli/latest/reference/dlm/create-lifecycle-policy.html

See ExcludeDataVolumeTags option.

Would you like to implement a fix?

No response

github-actions[bot] commented 2 years ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

MasLaurent commented 1 month ago

Any news for this option ?