Skip to content

Commit cb565b3

Browse files
[ndr-387] removed count for global permissions
1 parent f284431 commit cb565b3

3 files changed

Lines changed: 8 additions & 12 deletions

File tree

base_iam/iam_github_dev_test_pre-prod_prod.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1+
2+
resource "aws_iam_role_policy_attachment" "ReadOnlyAccess" {
3+
role = aws_iam_role.github_actions.name
4+
policy_arn = "arn:aws:iam::aws:policy/ReadOnlyAccess"
5+
}
6+
17
# POLICY SPLIT INTO 3 PARTS TO AVOID HITTING THE 6,144 CHARACTER LIMIT FOR AWS IAM POLICIES
28

39
resource "aws_iam_role_policy_attachment" "github_actions_dev_test_pre-prod_prod_1" {
4-
count = local.is_dev_test_pre-prod_prod ? 1 : 0
10+
511
role = aws_iam_role.github_actions.name
612
policy_arn = aws_iam_policy.github_actions_dev_test_pre-prod_prod_1[0].arn
713
}
814

915
resource "aws_iam_policy" "github_actions_dev_test_pre-prod_prod_1" {
10-
count = local.is_dev_test_pre-prod_prod ? 1 : 0
1116
name = "${terraform.workspace}-github-actions-policy-dev_test_pre-prod_prod_1"
1217
path = "/"
1318
policy = jsonencode({
@@ -114,13 +119,11 @@ resource "aws_iam_policy" "github_actions_dev_test_pre-prod_prod_1" {
114119

115120

116121
resource "aws_iam_role_policy_attachment" "github_actions_dev_test_pre-prod_prod_2" {
117-
count = local.is_dev_test_pre-prod_prod ? 1 : 0
118122
role = aws_iam_role.github_actions.name
119123
policy_arn = aws_iam_policy.github_actions_dev_test_pre-prod_prod_2[0].arn
120124
}
121125

122126
resource "aws_iam_policy" "github_actions_dev_test_pre-prod_prod_2" {
123-
count = local.is_dev_test_pre-prod_prod ? 1 : 0
124127
name = "${terraform.workspace}-github-actions-policy-dev_test_pre-prod_prod_2"
125128
path = "/"
126129
policy = jsonencode({
@@ -266,13 +269,11 @@ resource "aws_iam_policy" "github_actions_dev_test_pre-prod_prod_2" {
266269

267270

268271
resource "aws_iam_role_policy_attachment" "github_actions_dev_test_pre-prod_prod_3" {
269-
count = local.is_dev_test_pre-prod_prod ? 1 : 0
270272
role = aws_iam_role.github_actions.name
271273
policy_arn = aws_iam_policy.github_actions_dev_test_pre-prod_prod_3[0].arn
272274
}
273275

274276
resource "aws_iam_policy" "github_actions_dev_test_pre-prod_prod_3" {
275-
count = local.is_dev_test_pre-prod_prod ? 1 : 0
276277
name = "${terraform.workspace}-github-actions-policy-dev_test_pre-prod_prod_3"
277278
path = "/"
278279
policy = jsonencode({

base_iam/iam_github_role.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,3 @@ resource "aws_iam_role" "github_actions" {
6464
}
6565
)
6666
}
67-
68-
resource "aws_iam_role_policy_attachment" "ReadOnlyAccess" {
69-
role = aws_iam_role.github_actions.name
70-
policy_arn = "arn:aws:iam::aws:policy/ReadOnlyAccess"
71-
}

base_iam/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ locals {
3131
shared_terraform_state_bucket = "ndr-${var.environment}-terraform-state-${data.aws_caller_identity.current.account_id}"
3232

3333
is_dev_pre-prod_prod = !contains(["ndr-test"], terraform.workspace)
34-
is_dev_test_pre-prod_prod = true
34+
# is_dev_test_pre-prod_prod = true
3535
is_dev_test = !contains(["pre-prod", "prod"], terraform.workspace)
3636
is_dev = !contains(["ndr-test", "pre-prod", "prod"], terraform.workspace)
3737
is_pre-prod_prod = contains(["pre-prod", "prod"], terraform.workspace)

0 commit comments

Comments
 (0)