terraform-provider-digitalocean icon indicating copy to clipboard operation
terraform-provider-digitalocean copied to clipboard

Output test_url to easily click and check that the example has worked

Open kriswuollett opened this issue 3 years ago • 1 comments

  • If IP address is not available yet, "[PENDING]" is shown, resolves #692

kriswuollett avatar Sep 21 '21 16:09 kriswuollett

We managed to achieve this in a much cleaner way:

resource "helm_release" "ingress" {
  name       = "ingress"
  repository = "https://kubernetes.github.io/ingress-nginx"
  chart      = "ingress-nginx"
  namespace = "ingress-nginx"
  create_namespace = true

  set {
    name  = "service.annotations.service\\.beta\\.kubernetes\\.io/do-loadbalancer-name"
    value = var.cluster_name
  }
}

# ---------------------------------------------------------------------------------------------------------------------
# Retrieve the LB at DO
# ---------------------------------------------------------------------------------------------------------------------

data "digitalocean_loadbalancer" "lb" {
  depends_on = [helm_release.ingress]
  name = var.cluster_name
}

In the case of this code, you can simply create the following output:

output "test_url" {
  value = data.digitalocean_loadbalancer.lb.ip
}

verenion avatar May 30 '22 21:05 verenion