Skip to content

Commit 77b5618

Browse files
authored
refactor: do not use templates/external-dns-values.yaml and set necessary values in the eks-external-dns.tf file (#192)
1 parent 1910946 commit 77b5618

File tree

3 files changed

+25
-34
lines changed

3 files changed

+25
-34
lines changed

terraform/layer2-k8s/eks-external-dns.tf

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,33 @@ locals {
44
enabled = local.helm_releases[index(local.helm_releases.*.id, "external-dns")].enabled
55
chart = local.helm_releases[index(local.helm_releases.*.id, "external-dns")].chart
66
repository = local.helm_releases[index(local.helm_releases.*.id, "external-dns")].repository
7-
chart_version = local.helm_releases[index(local.helm_releases.*.id, "external-dns")].version
7+
chart_version = local.helm_releases[index(local.helm_releases.*.id, "external-dns")].chart_version
88
namespace = local.helm_releases[index(local.helm_releases.*.id, "external-dns")].namespace
99
}
10-
}
10+
external_dns_values = <<VALUES
11+
rbac:
12+
create: true
1113
12-
data "template_file" "external_dns" {
13-
count = local.external_dns.enabled ? 1 : 0
14+
serviceAccount:
15+
create: true
16+
name: "external-dns"
17+
annotations:
18+
"eks.amazonaws.com/role-arn": ${local.external_dns.enabled ? module.aws_iam_external_dns[0].role_arn : ""}
1419
15-
template = file("${path.module}/templates/external-dns.yaml")
16-
vars = {
17-
role_arn = module.aws_iam_external_dns[count.index].role_arn
18-
domain_name = local.domain_name
19-
zone_type = "public"
20-
}
20+
provider: aws
21+
domainFilters: [${local.domain_name}]
22+
extraArgs:
23+
- --aws-zone-type=public
24+
- --aws-batch-change-size=1000
25+
26+
serviceMonitor:
27+
enabled: false
28+
29+
sources:
30+
- service
31+
- ingress
32+
# - istio-virtualservice
33+
VALUES
2134
}
2235

2336
#tfsec:ignore:kubernetes-network-no-public-egress tfsec:ignore:kubernetes-network-no-public-ingress
@@ -121,7 +134,7 @@ resource "helm_release" "external_dns" {
121134
max_history = var.helm_release_history_size
122135

123136
values = [
124-
data.template_file.external_dns[count.index].rendered,
137+
local.external_dns_values
125138
]
126139

127140
}

terraform/layer2-k8s/helm-releases.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ releases:
5151
enabled: true
5252
chart: external-dns
5353
repository: https://kubernetes-sigs.github.io/external-dns
54-
version: 1.5.0
54+
chart_version: 1.5.0
5555
namespace: external-dns
5656
- id: external-secrets
5757
enabled: true

terraform/layer2-k8s/templates/external-dns.yaml

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

0 commit comments

Comments
 (0)