Skip to content

Commit aecb597

Browse files
committed
CCM-8742: Grafana cross account access trust pol condition
1 parent c6f5198 commit aecb597

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

infrastructure/terraform/components/acct/variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,3 @@ variable "initial_cli_secrets_provision_override" {
7070
# Usage like:
7171
# ... -a apply -- -var initial_cli_secrets_provision_override={\"github_pat\":\"l0ngstr1ng"}
7272
}
73-
74-
variable "observability_account_id" {
75-
type = string
76-
description = "The Observability Account ID that needs access"
77-
}

infrastructure/terraform/components/acct/iam_role_grafana_access.tf renamed to infrastructure/terraform/components/app/iam_role_grafana_access.tf

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "aws_iam_role" "grafana_access" {
2-
name = "${local.csi}-grafana-cross-access-role"
2+
name = replace("${local.csi}-grafana-cross-access-role", "-${var.component}", "")
33
assume_role_policy = data.aws_iam_policy_document.observability_grafana_role_assume_role_policy.json
44
}
55

@@ -9,7 +9,17 @@ data "aws_iam_policy_document" "observability_grafana_role_assume_role_policy" {
99
effect = "Allow"
1010
principals {
1111
type = "AWS"
12-
identifiers = ["arn:aws:iam::${var.observability_account_id}:role/${local.csi}-grafana-workspace-role"]
12+
identifiers = [
13+
"arn:aws:iam::${var.observability_account_id}:root"
14+
]
15+
}
16+
condition {
17+
test = "ArnLike"
18+
variable = "aws:PrincipalArn"
19+
20+
values = [
21+
"arn:aws:iam::${var.observability_account_id}:role/*grafana-workspace-role"
22+
]
1323
}
1424
}
1525
}

infrastructure/terraform/components/app/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,8 @@ variable "enable_letters" {
187187
description = "Feature flag for letters"
188188
default = false
189189
}
190+
191+
variable "observability_account_id" {
192+
type = string
193+
description = "The Observability Account ID that needs access"
194+
}

0 commit comments

Comments
 (0)