Skip to content

Commit ab9d03d

Browse files
committed
move IRSA roles from base AWS provisioning
1 parent 3ed16ca commit ab9d03d

4 files changed

Lines changed: 11 additions & 83 deletions

File tree

core-env/aws/main.tf

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -105,45 +105,3 @@ resource "aws_iam_role_policy_attachment" "gha_attachment" {
105105

106106

107107

108-
#
109-
# Secrets Manager for ESO
110-
#
111-
112-
resource "aws_iam_policy" "demo_secrets_policy" {
113-
name = "sedemo-secrets-access-from-eks"
114-
description = "Policy to grant demo cluster access to secrets via ESO"
115-
116-
policy = templatefile(
117-
"${path.module}/templates/secrets_policy.json.tpl",
118-
{
119-
AWS_ACCOUNT_ID = data.aws_caller_identity.current.id
120-
}
121-
)
122-
123-
tags = var.common_tags
124-
lifecycle {
125-
create_before_destroy = true
126-
}
127-
}
128-
129-
resource "aws_iam_role" "secrets_role" {
130-
name = "sedemo-secrets-access-from-eks"
131-
description = "Role grants access to secrets policy for ESO"
132-
133-
assume_role_policy = templatefile(
134-
"${path.module}/templates/secrets_role.json.tpl",
135-
{
136-
137-
}
138-
)
139-
140-
tags = var.common_tags
141-
lifecycle {
142-
create_before_destroy = true
143-
}
144-
}
145-
146-
resource "aws_iam_role_policy_attachment" "secrets_attachment" {
147-
role = aws_iam_role.secrets_role.name
148-
policy_arn = aws_iam_policy.demo_secrets_policy.arn
149-
}

core-env/aws/templates/secrets_policy.json.tpl

Lines changed: 0 additions & 25 deletions
This file was deleted.

core-env/aws/templates/secrets_role.json.tpl

Lines changed: 0 additions & 16 deletions
This file was deleted.

core-env/eks-clusters/main.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,14 @@ resource "aws_route53_record" "records" {
205205
records = [data.kubernetes_service_v1.nginx_ingress.status.0.load_balancer.0.ingress.0.hostname]
206206
depends_on = [helm_release.nginx_ingress]
207207
}
208+
209+
210+
#
211+
#
212+
#. TODO: use `output "secrets_policy_name"` to attach to the OIDC role created by irsa=true above.
213+
#
214+
215+
resource "aws_iam_role_policy_attachment" "s3_read_only" {
216+
role = eks.module.oidc_provider_arn
217+
policy_arn = data.terraform_remote_state.arad_aws_state.outputs.secrets_policy_arn
218+
}

0 commit comments

Comments
 (0)