Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add support for aliases and grants on aws_kms_external_key #3

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ resource "aws_kms_alias" "this" {

name = var.aliases_use_name_prefix ? null : "alias/${each.value}"
name_prefix = var.aliases_use_name_prefix ? "alias/${each.value}-" : null
target_key_id = aws_kms_key.this[0].id
target_key_id = var.create_external ? aws_kms_external_key.this[0].id : aws_kms_key.this[0].key_id
}

################################################################################
Expand All @@ -264,7 +264,7 @@ resource "aws_kms_grant" "this" {
for_each = { for k, v in var.grants : k => v if var.create }

name = try(each.value.name, each.key)
key_id = aws_kms_key.this[0].key_id
key_id = var.create_external ? aws_kms_external_key.this[0].id : aws_kms_key.this[0].key_id
grantee_principal = each.value.grantee_principal
operations = each.value.operations

Expand Down