Skip to content

Commit fab69a1

Browse files
authored
Merge pull request #202 from nlamirault/feat/refactoring-iam
IAM: Refactoring buckets usage for Loki, Tempo and Mimir
2 parents bb39a80 + 72f7405 commit fab69a1

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

.github/labeler.yml

+13-13
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@
1616

1717
# Labels for action/labeler
1818

19-
area/kubernetes:
20-
- kubernetes/*
21-
- kubernetes/**/*
22-
23-
area/gcp:
24-
- iac/gcp/*
25-
- iac/gcp/**/*
19+
area/terraform:
20+
- adot/*.tf
21+
- amg/*.tf
22+
- amp/*.tf
23+
- cloudwatch/*.tf
24+
- grafana/*.tf
25+
- loki/*.tf
26+
- mimir/*.tf
27+
- mimir/*.tf
28+
- prometheus/*.tf
29+
- tempo/*.tf
2630

2731
area/aws:
2832
- iac/aws/*
2933
- iac/aws/**/*
3034

31-
area/azure:
32-
- iac/azure/*
33-
- iac/azure/**/*
34-
3535
kind/documentation:
36-
- docs/*
37-
- docs/**/*
36+
- README.md
37+
- "**/*.md"

modules/loki/iam.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ data "aws_iam_policy_document" "bucket" {
2626
]
2727

2828
#tfsec:ignore:aws-iam-no-policy-wildcards
29-
resources = [
30-
module.buckets_data[*].s3_bucket_arn,
31-
"${module.buckets_data[*].s3_bucket_arn}/*"
32-
]
29+
resources = concat(
30+
[for b in toset(local.buckets_names) : module.buckets_data[b].s3_bucket_arn],
31+
[for b in toset(local.buckets_names) : format("%s/*", module.buckets_data[b].s3_bucket_arn)]
32+
)
3333
}
3434

3535
dynamic "statement" {

modules/mimir/iam.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ data "aws_iam_policy_document" "bucket" {
2626
]
2727

2828
#tfsec:ignore:aws-iam-no-policy-wildcards
29-
resources = [
30-
module.buckets_data[*].s3_bucket_arn,
31-
"${module.buckets_data[*].s3_bucket_arn}/*"
32-
]
29+
resources = concat(
30+
[for b in toset(local.buckets_names) : module.buckets_data[b].s3_bucket_arn],
31+
[for b in toset(local.buckets_names) : format("%s/*", module.buckets_data[b].s3_bucket_arn)]
32+
)
3333
}
3434

3535
dynamic "statement" {

modules/tempo/iam.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ data "aws_iam_policy_document" "bucket" {
2828
]
2929

3030
#tfsec:ignore:aws-iam-no-policy-wildcards
31-
resources = [
32-
module.buckets_data[*].s3_bucket_arn,
33-
"${module.buckets_data[*].s3_bucket_arn}/*"
34-
]
31+
resources = concat(
32+
[for b in toset(local.buckets_names) : module.buckets_data[b].s3_bucket_arn],
33+
[for b in toset(local.buckets_names) : format("%s/*", module.buckets_data[b].s3_bucket_arn)]
34+
)
3535
}
3636

3737
dynamic "statement" {

0 commit comments

Comments
 (0)