Skip to content

Commit 5759660

Browse files
trust store
1 parent b3185c3 commit 5759660

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

infrastructure/stacks/api-layer/truststore_s3_bucket.tf

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ module "s3_truststore_bucket" {
77
workspace = terraform.workspace
88
}
99

10-
resource "aws_s3_bucket_policy" "truststore" {
11-
bucket = module.s3_truststore_bucket.storage_bucket_id
12-
policy = data.aws_iam_policy_document.truststore_api_gateway.json
13-
}
14-
1510
data "aws_iam_policy_document" "truststore_api_gateway" {
1611
statement {
1712
sid = "Enable S3 access permissions for API Gateway"
@@ -31,9 +26,16 @@ data "aws_iam_policy_document" "truststore_api_gateway" {
3126
}
3227

3328
resource "aws_s3_object" "pem_file" {
34-
bucket = module.s3_truststore_bucket.storage_bucket_name
29+
bucket = module.s3_truststore_bucket.storage_bucket_id
3530
key = "truststore.pem"
3631
content = local.pem_file_content
3732

3833
acl = "private"
3934
}
35+
36+
resource "aws_s3_bucket_policy" "truststore" {
37+
bucket = module.s3_truststore_bucket.storage_bucket_id
38+
policy = data.aws_iam_policy_document.truststore_api_gateway.json
39+
40+
depends_on = [aws_s3_object.pem_file]
41+
}

0 commit comments

Comments
 (0)