Skip to content

Commit 97d7c93

Browse files
committed
fix: Add IAM policy for access to the exports bucket.
1 parent 585b852 commit 97d7c93

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

tofu/config/service/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module "system" {
3535
deletion_protection = var.deletion_protection
3636
image_tag = local.image_tag
3737
image_tags_mutable = var.image_tags_mutable
38+
log_level = var.log_level
3839

3940
consumer_container_count = var.consumer_container_count
4041
consumer_cpu = var.consumer_cpu

tofu/modules/ephemeral_service/docker.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ resource "docker_image" "container" {
1111
]
1212

1313
auth_config {
14-
host_name = data.aws_ecr_authorization_token.token.proxy_endpoint
15-
password = data.aws_ecr_authorization_token.token.password
14+
host_name = data.aws_ecr_authorization_token.token.proxy_endpoint
15+
password = data.aws_ecr_authorization_token.token.password
1616
user_name = data.aws_ecr_authorization_token.token.user_name
1717
}
1818
}

tofu/modules/system/ecs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ module "consumer" {
123123

124124
module "exporter" {
125125
source = "../ephemeral_service"
126-
depends_on = [aws_iam_policy.queue, aws_iam_policy.secrets]
126+
depends_on = [aws_iam_policy.exports, aws_iam_policy.secrets]
127127

128128
project = var.project
129129
environment = var.environment
@@ -135,7 +135,7 @@ module "exporter" {
135135
logging_key_id = var.logging_key_arn
136136
otel_ssm_parameter_arn = module.otel_config.ssm_parameter_arn
137137
execution_policies = [aws_iam_policy.secrets.arn]
138-
task_policies = [aws_iam_policy.queue.arn]
138+
task_policies = [aws_iam_policy.exports.arn]
139139
dockerfile = "Dockerfile.exporter"
140140
docker_context = "${path.module}/../../../"
141141

tofu/modules/system/iam.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
resource "aws_iam_policy" "exports" {
2+
name_prefix = "${local.prefix}-exports-access-"
3+
description = "Allow access to the S3 bucket for Senzing exports."
4+
5+
policy = jsonencode(yamldecode(templatefile("${path.module}/templates/exports-access-policy.yaml.tftpl", {
6+
bucket_arn = module.s3.arn
7+
kms_arn = aws_kms_key.queue.arn
8+
})))
9+
10+
tags = var.tags
11+
12+
lifecycle {
13+
create_before_destroy = true
14+
}
15+
}
16+
117
resource "aws_iam_policy" "queue" {
218
name_prefix = "${local.prefix}-queue-access-"
319
description = "Allow access to the SQS queues for Senzing."
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Version: '2012-10-17'
2+
Statement:
3+
- Sid: KeyAccess
4+
Effect: Allow
5+
Action:
6+
- kms:Decrypt
7+
- kms:GenerateDataKey
8+
Resource:
9+
- "${kms_arn}"
10+
- Sid: S3Access
11+
Effect: Allow
12+
Action:
13+
- s3:PutObject
14+
Resource:
15+
- "${bucket_arn}:*"

0 commit comments

Comments
 (0)