Skip to content

Commit

Permalink
fix: enable the KMS key creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardolsmendes committed Jun 3, 2024
1 parent 979ed19 commit 8f7431f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
8 changes: 6 additions & 2 deletions infrastructure/environments/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ module "athena" {

environment = var.environment
athena_query_results_bucket_name = var.athena_query_results_bucket_name
data_bucket_id = module.core.data_bucket_id
silver_database_name = module.glue.silver_database_name
# =====================================================================================
# DELETE THIS AND UNCOMMENT THE FOLLOWING LINE TO ENABLE SSE-KMS ENCRYPTION IN S3.
# =====================================================================================
s3_encryption_key_arn = module.core.s3_encryption_key_arn
data_bucket_id = module.core.data_bucket_id
silver_database_name = module.glue.silver_database_name
}
18 changes: 9 additions & 9 deletions infrastructure/modules/core/kms.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
# ACCOUNTS. DELETE THE LINES DELIMITED BY `# =...=` AND UNCOMMENT THE FOLLOWING RESOURCES
# TO CREATE/ENABLE IT.
# =======================================================================================
# resource "aws_kms_key" "s3" {
# description = "This key protects S3 objects tackled by the AWS Glue CI/CD Blueprint"
# enable_key_rotation = true
# }
#
# resource "aws_kms_alias" "s3" {
# name = "alias/glue-ci-cd-blueprint/s3-${var.environment}"
# target_key_id = aws_kms_key.s3.key_id
# }
resource "aws_kms_key" "s3" {
description = "This key protects S3 objects tackled by the AWS Glue CI/CD Blueprint"
enable_key_rotation = true
}

resource "aws_kms_alias" "s3" {
name = "alias/glue-ci-cd-blueprint/s3-${var.environment}"
target_key_id = aws_kms_key.s3.key_id
}
6 changes: 3 additions & 3 deletions infrastructure/modules/core/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ output "data_bucket_id" {
# =======================================================================================
# THE KMS KEY IS NOT CREATED BY DEFAULT. PLEASE REFER TO `kms.tf` FOR DETAILS.
# =======================================================================================
# output "s3_encryption_key_arn" {
# value = aws_kms_key.s3.arn
# }
output "s3_encryption_key_arn" {
value = aws_kms_key.s3.arn
}

0 comments on commit 8f7431f

Please sign in to comment.