This template creates an AWS KMS key and attaches a policy to it that allows all KMS actions for all IAM users.

Terraform Template

resource "aws_kms_key" "example" {
  description = "example"
}

resource "aws_kms_key_policy" "example" {
  key_id = aws_kms_key.example.id
  policy = jsonencode({
 Id = "example"
 Statement = [
 {
 Action = "kms:*"
 Effect = "Allow"
 Principal = {
 AWS = "*"
 }

 Resource = "*"
 Sid = "Enable IAM User Permissions"
 },
 ]
 Version = "2012-10-17"
 })
}