Skip to content

Commit

Permalink
Refactor DNS configuration to use updated Kubernetes service for host…
Browse files Browse the repository at this point in the history
…name retrieval
  • Loading branch information
adamlahbib committed Nov 16, 2024
1 parent b36a37e commit 6275096
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion terraform/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "cloudflare_record" "app" {
zone_id = var.CLOUDFLARE_ZONE_ID
name = var.dns_name
content = try(
kubernetes_ingress_v1.prod-ingress.status[0].load_balancer[0].ingress[0].hostname,
data.kubernetes_service.nginx_ingress.status[0].load_balancer.ingress[0].hostname,
"PENDING_LB_HOSTNAME"
)
type = "CNAME"
Expand Down
7 changes: 7 additions & 0 deletions terraform/ingress.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ resource "helm_release" "nginx-ingress-controller" {
}
}

data "kubernetes_service" "nginx_ingress" {
metadata {
name = "nginx-ingress-controller"
namespace = "default"
}
}

resource "kubernetes_namespace" "dev" {
metadata {
name = "dev"
Expand Down

0 comments on commit 6275096

Please sign in to comment.