Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name attribute in kubernetes_pod should not be required #2645

Open
morganbasset opened this issue Dec 11, 2024 · 0 comments
Open

Name attribute in kubernetes_pod should not be required #2645

morganbasset opened this issue Dec 11, 2024 · 0 comments
Assignees
Labels

Comments

@morganbasset
Copy link

Terraform Version, Provider Version and Kubernetes Version

Terraform version: 1.9.8
Kubernetes provider version: 1.29.1
Kubernetes version: 1.26.15

Affected Resource(s)

kubernetes.kubernetes_pod

Terraform Configuration Files

## Install Helm chart
resource "helm_release" "helm_application" {
  name       = format("%s-%s", "demo", var.uid)
  chart      = "./application"
  namespace  = var.namespace
  wait       = false
  set {
    name  = "uid"
    value = var.uid
  }
}

data "kubernetes_pod" "application_pod" {
  metadata {
    namespace = var.namespace
    labels = {
      "app.kubernetes.io/instance" = helm_release.helm_application.name
    }
  }
}

Debug Output

Error: resource name may not be empty

Expected Behavior

Work as the documentation say, allow to search for pod only with label. Metadata.name should not be required

I try to get the pod name after an helm installation.
In the documentation, the name attribute of metadata is in the optional block (https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/service.html#name-1) and it make sense for my case.

Actual Behavior

Metadata.name is required

References

https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/pod#name-278

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
Klopklopi added a commit to Klopklopi/terraform-provider-kubernetes that referenced this issue Dec 30, 2024
Fixed the missing implementation of selection with label in the datasource. Before it was only getting the pods with the name attribute, now it can select with labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants