File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -6,18 +6,36 @@ description: |-
66 This data source is a generic way to query for a list of resources from the Kubernetes API and filter them.
77---
88
9- # kubernetes_resource
9+ # kubernetes_resources
1010
1111This data source is a generic way to query for a list of Kubernetes resources and filter them using a label or field selector.
1212
13- ### Example: Get a list of namespaces excluding "kube-system"
13+ ### Example: Get a list of namespaces excluding "kube-system" using ` field_selector `
1414
1515``` hcl
16- data "kubernetes_resource " "example" {
16+ data "kubernetes_resources " "example" {
1717 api_version = "v1"
1818 kind = "Namespace"
1919 field_selector = "metadata.name!=kube-system"
2020}
21+
22+ output "test" {
23+ value = length(data.kubernetes_resources.namespaces.objects)
24+ }
25+ ```
26+
27+ ### Example: Get a list of namespaces excluding "kube-system" using ` label_selector `
28+
29+ ``` hcl
30+ data "kubernetes_resources" "example" {
31+ api_version = "v1"
32+ kind = "Namespace"
33+ label_selector = "kubernetes.io/metadata.name!=kube-system"
34+ }
35+
36+ output "test" {
37+ value = length(data.kubernetes_resources.namespaces.objects)
38+ }
2139```
2240
2341## Argument Reference
@@ -29,4 +47,5 @@ The following arguments are supported:
2947* ` label_selector ` - (Optional) A selector to restrict the list of returned objects by their labels.
3048* ` field_selector ` - (Optional) A selector to restrict the list of returned objects by their fields.
3149* ` namespace ` - (Optional) The namespace of the requested resource.
50+ * ` object ` - (Optional) The response returned from the API server.
3251
You can’t perform that action at this time.
0 commit comments