Skip to content

Commit

Permalink
feat: added external key resource
Browse files Browse the repository at this point in the history
  • Loading branch information
theprashantyadav committed Jun 12, 2023
1 parent 49cc3e9 commit 59c8ad2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
21 changes: 9 additions & 12 deletions _example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ module "kms_key" {
environment = "test"
label_order = ["name", "environment"]

deletion_window_in_days = 15
alias = "alias/cloudtrail_Name"
enabled = false
multi_region = true
create_replica_external_enabled = true
create_replica_enabled = true
create_external_enabled = true
valid_to = "2023-11-21T23:20:50Z"
key_material_base64 = "Wblj06fduthWggmsT0cLVoIMOkeLbc2kVfMud77i/JY="



deletion_window_in_days = 15
alias = "alias/cloudtrail_Name"
enabled = true
multi_region = false
create_replica_external_enabled = false
create_replica_enabled = false
create_external_enabled = false
valid_to = "2023-11-21T23:20:50Z"
key_material_base64 = "Wblj06fduthWggmsT0cLVoIMOkeLbc2kVfMud77i/JY="
}
9 changes: 5 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ module "labels" {
data "aws_caller_identity" "current" {}
data "aws_partition" "current" {}

# Module : KMS KEY
# Description : This terraform module creates a KMS Customer Master Key (CMK) and its alias.
####----------------------------------------------------------------------------------
## This terraform module creates a KMS Customer Master Key (CMK) and its alias..
####----------------------------------------------------------------------------------
resource "aws_kms_key" "default" {
count = var.enabled ? 1 : 0

Expand Down Expand Up @@ -57,7 +58,7 @@ resource "aws_kms_replica_key" "replica-key" {
bypass_policy_lockout_safety_check = var.bypass_policy_lockout_safety_check
deletion_window_in_days = var.deletion_window_in_days
description = var.description
primary_key_arn = join("",aws_kms_key.default.*.arn)
primary_key_arn = join("", aws_kms_key.default.*.arn)
enabled = var.is_enabled
policy = data.aws_iam_policy_document.default.json

Expand All @@ -76,7 +77,7 @@ resource "aws_kms_replica_external_key" "replica-external-key" {
enabled = var.is_enabled
key_material_base64 = var.key_material_base64
policy = data.aws_iam_policy_document.default.json
primary_key_arn = join("",aws_kms_key.default.*.arn)
primary_key_arn = join("", aws_kms_key.default.*.arn)
valid_to = var.valid_to

tags = module.labels.tags
Expand Down

0 comments on commit 59c8ad2

Please sign in to comment.