Skip to content

Commit

Permalink
Merge pull request #1 from kabisa/change-to-templatefile
Browse files Browse the repository at this point in the history
modified to use of templatefile()
  • Loading branch information
pvlierop authored Apr 14, 2022
2 parents ffdca80 + 6c79850 commit c717f76
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
34 changes: 17 additions & 17 deletions iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ resource "aws_iam_policy" "external-dns-iam-policy" {
}

resource "aws_iam_role" "external-dns-iam-role" {
name = "EksExternalDnsIAMRole"
name = "EksExternalDnsIAMRole"
assume_role_policy = jsonencode(
{
Statement = [
{
Action = "sts:AssumeRoleWithWebIdentity"
Condition = {
StringEquals = {
"${var.oidc_host_path}:aud" = "sts.amazonaws.com"
{
Statement = [
{
Action = "sts:AssumeRoleWithWebIdentity"
Condition = {
StringEquals = {
"${var.oidc_host_path}:aud" = "sts.amazonaws.com"
}
}
}
Effect = "Allow",
Principal = {
Federated = "arn:aws:iam::${var.account_id}:oidc-provider/${var.oidc_host_path}"
}
},
]
Version = "2012-10-17"
}
Effect = "Allow",
Principal = {
Federated = "arn:aws:iam::${var.account_id}:oidc-provider/${var.oidc_host_path}"
}
},
]
Version = "2012-10-17"
}
)
}

Expand Down
18 changes: 8 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
data "template_file" "external-dns" {
template = file("${path.module}/yamls/external-dns-values.yaml")
vars = {
region = var.region
aws_role_arn = aws_iam_role.external-dns-iam-role.arn
vpc_id = var.vpc_id
}
}

resource "helm_release" "aws-load-balancer-controller" {
name = "external-dns"
namespace = "kube-system"
Expand All @@ -16,7 +7,14 @@ resource "helm_release" "aws-load-balancer-controller" {
# appVersion: 0.7.6

values = [
data.template_file.external-dns.rendered
templatefile(
"${path.module}/yamls/external-dns-values.yaml",
{
region = var.region
aws_role_arn = aws_iam_role.external-dns-iam-role.arn
vpc_id = var.vpc_id
}
)
]
}

0 comments on commit c717f76

Please sign in to comment.