resource "aws_kms_key" "this" {
  count = var.enabled ? 1 : 0
  description             = var.description
  enable_key_rotation     = true
  deletion_window_in_days = var.deletion_window_days
}

resource "aws_kms_alias" "this" {
  count = var.enabled ? 1 : 0
  name          = local.alias_name
  target_key_id = aws_kms_key.this[0].key_id
}