Skip to content

Commit

Permalink
trimmed s3 bucket permission reference
Browse files Browse the repository at this point in the history
  • Loading branch information
DeeAjayi committed Aug 20, 2024
1 parent ebff85c commit 2adf0c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data "aws_iam_policy_document" "truefoundry_bucket_policy" {
]

resources = concat(
["arn:aws:s3:::${local.truefoundry_unique_name}*"],
["arn:aws:s3:::${local.truefoundry_trimmed_unique_name}*"],
var.truefoundry_artifact_buckets_will_read,
)
}
Expand All @@ -34,7 +34,7 @@ data "aws_iam_policy_document" "truefoundry_bucket_policy" {
"s3:DeleteObject",
]
resources = [
for bucket in concat(["arn:aws:s3:::${local.truefoundry_unique_name}*"], var.truefoundry_artifact_buckets_will_read) :
for bucket in concat(["arn:aws:s3:::${local.truefoundry_trimmed_unique_name}*"], var.truefoundry_artifact_buckets_will_read) :
"${bucket}/*"
]
}
Expand Down
1 change: 1 addition & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
locals {

truefoundry_unique_name = var.truefoundry_s3_enable_override ? var.truefoundry_s3_override_name : "${var.cluster_name}-truefoundry"
truefoundry_trimmed_unique_name = trimsuffix(substr(local.truefoundry_unique_name, 0, 37), "-")

truefoundry_db_unique_name = var.truefoundry_db_enable_override ? var.truefoundry_db_override_name : "${var.cluster_name}-db"

Expand Down

0 comments on commit 2adf0c3

Please sign in to comment.