data "aws_iam_policy_document" "iam_admin_kms" {

  statement {
    sid    = "AllowKMSthings"
    effect = "Allow"
    actions = [
      "kms:Create*",
      "kms:Describe*",
      "kms:Enable*",
      "kms:List*",
      "kms:Put*",
      "kms:Update*",
      "kms:Revoke*",
      "kms:Disable*",
      "kms:Get*",
      "kms:Delete*",
      "kms:TagResource",
      "kms:UntagResource",
      "kms:ScheduleKeyDeletion",
      "kms:CancelKeyDeletion"
    ]
    resources = ["*"]
  }

}

resource "aws_iam_policy" "iam_admin_kms" {
  name        = "iam_admin_kms"
  path        = "/user/"
  description = "KMS access for IAM admins"
  policy      = data.aws_iam_policy_document.iam_admin_kms.json
}
