hashicorp / terraform-provider-kubernetes

Terraform Kubernetes provider
https://www.terraform.io/docs/providers/kubernetes/
Mozilla Public License 2.0
1.58k stars 967 forks source link

Extend the kubernetes_all_namespaces data source to utilize labels to filter what is returned #945

Open jbellow opened 4 years ago

jbellow commented 4 years ago

Description

Currently the kubernetes_all_namespaces data source simply pulls all the namespaces in the cluster and returns that to the caller. I have a use case where I want particular namespaces that have specific labels applied to them. I tried several ways to pull namespaces and associated metadata via terraform, but was never able to the label data that I needed in order to filter.

Potential Terraform Configuration

A potential way this could be achieved is by leveraging the metadata structure and then passing that back to the K8's api call to get the namespaces

data "kubernetes_all_namespaces" "allns" {
  metadata {
    labels = {
      my_awesome_enable_label : true
    }
  }
}

Community Note

jbellow commented 4 years ago

I have opened #948 to address this issue.

github-actions[bot] commented 2 years ago

Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!

simonvanderveldt commented 2 years ago

@aareet You commented in the PR that it was in the review queue, but nothing happened with it and now it's closed and not merged. Any chance this can be picked up again? Would be a great feature to have.

github-actions[bot] commented 2 years ago

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.