Hi everyone, I’d really appreciate some help on this one.
So, I’m creating an OVH Public Cloud Kubernetes cluster, which has gone great so far.
I have deployed a nginx-ingress-controller
via the helm_release
module:
resource "helm_release" "nginx_ingress" {
name = "ingress-nginx"
namespace = "ingress-nginx"
create_namespace = true
repository = "https://kubernetes.github.io/ingress-nginx"
chart = "ingress-nginx"
values = [var.helm.nginx-ingress.values]
}
As the service type is set to LoadBalancer
this triggers OVH to create a load balancer for me, great! However, I’m struggling with how I’d extract that new load balancer’s hostname/IP address via terraform, as I’d then like to create DNS records that point to it.
I can get it manually via kubectl get service ingress-nginx-controller -n ingress-nginx -o jsonpath="{.status.loadBalancer.ingress[0].hostname}"
but I can’t find a way to do it in terraform.
I have tried:
-
The helm release doesn’t expose the IP
-
Other modules Terraform Registry - Unfortunatly outdated
-
Terraform Registry - Doesn’t provide IP
-
Terraform Registry - LB wasn’t created via the service module
Any ideas?
Thanks!