Skip to content

Commit

Permalink
Merge branch 't26_s3-feat' of github.e.it.census.gov:terraform-module…
Browse files Browse the repository at this point in the history
…s/aws-t26-s3 into aws-t26-s3
  • Loading branch information
ashle001 committed Sep 22, 2020
2 parents bb1f4d8 + a96c00d commit 359df1a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 7 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
locals {
region = var.region

s3_bucket_names = formatlist("v-s3-%v", var.s3_bucket_names)
key_name = format("k-kms-%v", local.app_name)
}

8 changes: 3 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ resource "null_resource" "s3_create_wait" {
}
}

riesource "aws_s3_bucket_object" "this_objects" {
resource "aws_s3_bucket_object" "this_objects" {
bucket = aws_s3_bucket.this.id
count = length(var.bucket_folders)
key = format("%s/", element(var.bucket_folders, count.index))
Expand All @@ -114,10 +114,9 @@ riesource "aws_s3_bucket_object" "this_objects" {
}

#-------------------------------------------------------------------------
# EFS KMS KEY
# EFS KMS KEY AND ALIAS
#-------------------------------------------------------------------------
resource "aws_kms_key" "key" {
count = local.kms_key_arn_exists ? 0 : 1
description = "KMS CMK for title26_s3 ${local.name}"
enable_key_rotation = true

Expand All @@ -129,7 +128,6 @@ resource "aws_kms_key" "key" {
}

resource "aws_kms_alias" "key" {
count = local.kms_key_arn_exists ? 0 : 1
name = "alias/${local.kms_key_name}"
target_key_id = (aws_kms_key.key.*)[0].key_id
target_key_id = aws_kms_key.key.key_id
}

0 comments on commit 359df1a

Please sign in to comment.