Skip to content

Commit 86f8894

Browse files
committed
create policy an role for secrets manager access from EKS
1 parent ba02223 commit 86f8894

File tree

4 files changed

+62
-11
lines changed

4 files changed

+62
-11
lines changed

akuity-bootstrap/main.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,13 @@ resource "akp_cluster" "kargo-cluster" {
119119
depends_on = [akp_kargo_instance.kargo-instance, akp_instance.se-demo-iac]
120120
}
121121

122+
resource "aws_route53_record" "records" {
123+
124+
zone_id = data.terraform_remote_state.eks_clusters.outputs.root_zone_id
125+
name = "argo.${data.terraform_remote_state.eks_clusters.outputs.demo_domain}"
126+
type = "CNAME"
127+
ttl = 5
128+
129+
records = [output.argo_server_url]
130+
depends_on = [akp_instance.se-demo-iac]
131+
}

core-env/aws/main.tf

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,50 @@ resource "aws_iam_role_policy_attachment" "gha_attachment" {
103103
policy_arn = aws_iam_policy.demo_gha_policy.arn
104104
}
105105

106-
output "demo_operator_role_arn" {
107-
value = aws_iam_role.demo_role.arn
106+
107+
108+
#
109+
# Secrets Manager for ESO
110+
#
111+
112+
113+
# Specific role for GHA via OIDC to assume (can also be assumed by team)
114+
resource "aws_iam_policy" "demo_secrets_policy" {
115+
name = var.priviledged_assumed_role
116+
description = "Policy to grant demo cluster access to secrets via ESO"
117+
118+
policy = templatefile(
119+
"${path.module}/templates/secrets_policy.json.tpl",
120+
{
121+
AWS_ACCOUNT_ID = data.aws_caller_identity.current.id
122+
}
123+
)
124+
125+
tags = var.common_tags
126+
lifecycle {
127+
create_before_destroy = true
128+
}
108129
}
109-
output "demo_pipeline_role_arn" {
110-
value = aws_iam_role.demo_gha_role.arn
130+
131+
# Specific role for GHA via OIDC to assume (can also be assumed by team)
132+
resource "aws_iam_role" "secrets_role" {
133+
name = var.priviledged_assumed_role
134+
description = "Role grants access to secrets policy for ESO"
135+
136+
assume_role_policy = templatefile(
137+
"${path.module}/templates/secrets_role.json.tpl",
138+
{
139+
140+
}
141+
)
142+
143+
tags = var.common_tags
144+
lifecycle {
145+
create_before_destroy = true
146+
}
147+
}
148+
149+
resource "aws_iam_role_policy_attachment" "secrets_attachment" {
150+
role = aws_iam_role.secrets_role.name
151+
policy_arn = aws_iam_policy.demo_secrets_policy.arn
111152
}

core-env/aws/variables.tf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ variable "common_tags" {
1313
}
1414
}
1515

16-
17-
variable "demo_domain" {
18-
description = "Domain apps will be exposed via ingress"
19-
type = string
20-
default = "demoapps.akuity.io"
21-
}
22-
2316
variable "email_usernames" {
2417
description = "Who can act as operator on ARAD resources, by assume operator role."
2518
default = [

core-env/eks-clusters/outputs.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,11 @@ output "primary_cluster_endpoint" {
66
}
77
output "primary_cluster_ca" {
88
value = module.eks.cluster_certificate_authority_data
9+
}
10+
output "demo_domain" {
11+
value = var.root_domain_name
12+
}
13+
14+
output "root_zone_id" {
15+
value = data.aws_route53_zone.root_demo_domain_zone.id
916
}

0 commit comments

Comments
 (0)