Terraform-provider-kubernetes: kubernetes_service documentation is outdated

Created on 22 Jan 2021  ·  3Comments  ·  Source: hashicorp/terraform-provider-kubernetes

Terraform Version, Provider Version and Kubernetes Version

Terraform version: 0.12.30
Kubernetes provider version: 2.0.0
Kubernetes version: 0.17

Affected Resource(s)

  • kubernetes_service

Terraform Configuration Files

resource "kubernetes_service" "traefik_vpce_ingress" {
  metadata {
    name      = "traefik-vpce-ingress-service"
    namespace = "kube-system"

    annotations = {
      "service.beta.kubernetes.io/aws-load-balancer-type"     = "nlb"
      "service.beta.kubernetes.io/aws-load-balancer-internal" = "true"
    }
  }

  spec {
    selector = {
      "k8s-app" = "traefik-ingress-lb"
    }
    external_traffic_policy = "Local"
    port {
      name        = "https"
      target_port = "http"
      port        = 443
    }
    port {
      name        = "http"
      target_port = "http"
      port        = 80
    }
    type                        = "LoadBalancer"
    load_balancer_source_ranges = var.traefik_ingress_cidr
  }
}
data "aws_lb" "traefik_vpce_nlb" {
  name = split("-", split(".", kubernetes_service.traefik_vpce_ingress.load_balancer_ingress.0.hostname).0).0
}

Debug Output

Shouldn't be needed

Panic Output

None

Steps to Reproduce

  1. terraform plan

Expected Behavior

Expected a successful plan, based on the content of https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service which lists the load_balancer_ingress attribute. However, according to the changelog of 2.0.0 of the TF provider, it appears this information has moved. According to the code in https://github.com/hashicorp/terraform-provider-kubernetes/pull/1071 it looks like it might now be found under status.*. load_balancer.*.ingress.*.hostname, although that is just a guess.

It seems like the documentation needs to be updated.

Actual Behavior

Error: Unsupported attribute

  on vpce_with_tls_termination_at_nlb.tf line 83, in data "aws_lb" "traefik_vpce_nlb":
  83:   name = split("-", split(".", kubernetes_service.traefik_vpce_ingress.load_balancer_ingress.0.hostname).0).0

This object has no argument, nested block, or exported attribute named
"load_balancer_ingress".

Important Factoids

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
bug

Most helpful comment

It is documented in the upgrade guide.

The change is as you assumed, e.g.:

 output "kubernetes_load_balancer_ip" {
   -  value = data.kubernetes_service.load_balancer.load_balancer_ingress[0].ip
   +  value = data.kubernetes_service.load_balancer.status[0].load_balancer[0].ingress[0].ip
 }

All 3 comments

It is documented in the upgrade guide.

The change is as you assumed, e.g.:

 output "kubernetes_load_balancer_ip" {
   -  value = data.kubernetes_service.load_balancer.load_balancer_ingress[0].ip
   +  value = data.kubernetes_service.load_balancer.status[0].load_balancer[0].ingress[0].ip
 }

Thanks for this bug report! Your guess is correct. The information can now be found under status.0.load_balancer.0.ingress.0.ip and status.0.load_balancer.0.ingress.0.hostname. The docs will have to be updated to reflect this.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings