Skip to content

Commit d99de77

Browse files
jacklearyaxelkrastek1-nhs
authored andcommitted
NRL-1188 athena kms
1 parent 9b04618 commit d99de77

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

terraform/account-wide-infrastructure/modules/athena/athena.tf

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ resource "aws_athena_database" "reporting-db" {
44
bucket = aws_s3_bucket.target-data-bucket.bucket
55

66
# encryption_configuration {
7-
# encryption_option = var.encryption_option
8-
# kms_key = var.kms_key_arn
7+
# encryption_option = "SSE_KMS"
8+
# kms_key = aws_kms_key.athena.arn
99
# }
1010

1111
force_destroy = true
@@ -19,14 +19,13 @@ resource "aws_athena_workgroup" "athena" {
1919
publish_cloudwatch_metrics_enabled = true
2020

2121
result_configuration {
22-
output_location = "s3://{aws_s3_bucket.example.bucket}/output/"
22+
output_location = "s3://{aws_s3_bucket.athena.bucket}/output/"
2323

2424
encryption_configuration {
2525
encryption_option = "SSE_KMS"
26-
kms_key_arn = var.kms_key_arn
26+
kms_key_arn = aws_kms_key.athena.arn
2727
}
2828
}
2929
}
3030

31-
tags = var.common_tags
3231
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resource "aws_kms_key" "athena" {
2+
}
3+
4+
resource "aws_kms_alias" "athena" {
5+
name = "alias/${var.prefix}-athena"
6+
target_key_id = aws_kms_key.athena.key_id
7+
}

terraform/account-wide-infrastructure/modules/athena/s3.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "athena" {
88
rule {
99
apply_server_side_encryption_by_default {
1010
sse_algorithm = "aws:kms"
11-
kms_master_key_id = var.kms_key_arn
11+
kms_master_key_id = aws_kms_key.athena.arn
1212
}
1313
}
1414

0 commit comments

Comments
 (0)