Skip to content

Commit

Permalink
s3 iam pol
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelhar committed Feb 20, 2025
1 parent b324e63 commit c286b16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
9 changes: 1 addition & 8 deletions modules/infra/submodules/storage/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ moved {
}

data "aws_iam_policy_document" "s3" {
count = local.create_s3 ? 1 : 0
statement {
effect = "Allow"
resources = [for b in local.s3_buckets : b.arn]
Expand Down Expand Up @@ -32,16 +31,10 @@ data "aws_iam_policy_document" "s3" {
}
}

moved {
from = aws_iam_policy.s3
to = aws_iam_policy.s3[0]
}

resource "aws_iam_policy" "s3" {
count = local.create_s3 ? 1 : 0
name = "${var.deploy_id}-S3"
path = "/"
policy = data.aws_iam_policy_document.s3[0].json
policy = data.aws_iam_policy_document.s3.json
}

moved {
Expand Down
6 changes: 3 additions & 3 deletions modules/infra/submodules/storage/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ output "info" {
name = aws_fsx_ontap_volume.eks[0].name
}
} : null
s3 = local.create_s3 ? {
s3 = {
buckets = { for k, b in local.s3_buckets : k => {
"bucket_name" = b.bucket_name,
"arn" = b.arn
Expand All @@ -42,8 +42,8 @@ output "info" {
"fips_regional_domain_name" = b.fips_regional_domain_name
}
}
iam_policy_arn = aws_iam_policy.s3[0].arn
} : null
iam_policy_arn = aws_iam_policy.s3.arn
}
ecr = local.create_ecr ? {
container_registry = join("/", concat(slice(split("/", aws_ecr_repository.this["environment"].repository_url), 0, 1), [var.deploy_id]))
iam_policy_arn = aws_iam_policy.ecr[0].arn
Expand Down

0 comments on commit c286b16

Please sign in to comment.