avx-pmarie-aws-infra/modules/eks-ingress-controller/main.tf

53 lines
1.3 KiB
Terraform
Raw Permalink Normal View History

2022-07-01 14:12:11 +02:00
locals {
string_list_tags = join(",", [for key, value in var.tags : "${key}=${value}"])
template_vars = merge(var.load_balancer_config, var.ingress_config, { "tags" = local.string_list_tags })
}
resource "helm_release" "nginx_ingress_contoller" {
name = "nginx-ingress-controller"
repository = "https://kubernetes.github.io/ingress-nginx"
chart = "ingress-nginx"
version = "4.0.18"
namespace = var.namespace
create_namespace = var.create_namespace
values = [
"${templatefile("values.yaml", local.template_vars)}"
]
set {
name = "controller.ingressClass"
value = var.ingress_class
}
set {
name = "controller.service.internal.enabled"
value = var.enable_internal_lb
}
set {
name = "controller.ingressClassResource.default"
value = var.is_default_ingress_class
}
}
resource "aws_route53_record" "public" {
zone_id = var.public_dns_record.zone_id
name = var.public_dns_record.name
type = "CNAME"
ttl = "60"
records = [
data.aws_lb.public.dns_name
]
}
resource "aws_route53_record" "internal" {
zone_id = var.internal_dns_record.zone_id
name = var.internal_dns_record.name
type = "CNAME"
ttl = "60"
records = [
data.aws_lb.internal.dns_name
]
}