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

Update kubectl_path_documents example doc. #140

Merged
merged 1 commit into from
Nov 10, 2021

Conversation

GezimSejdiu
Copy link
Contributor

Example uses kubectl_file_documents instead of kubectl_path_documents.
for_each has to be a set or a map and thus toset() is needed.
This update closes #135.

Example uses kubectl_file_documents instead of kubectl_path_documents.
for_each has to be a set or a map and thus toset() is needed.
This update closes gavinbunney#135.
@gavinbunney gavinbunney merged commit db60339 into gavinbunney:master Nov 10, 2021
@gavinbunney
Copy link
Owner

Thanks!

@GezimSejdiu
Copy link
Contributor Author

Thank you and everyone for contributing to such a great tool. Keep it up.

@indistinctTalk
Copy link

The use of documents with for_each is confusing given the advice in the attribute documentation below.

* `manifests` - Map of YAML documents with key being the document id, and value being the document yaml. Best used with `for_each` expressions.
* `documents` - List of YAML documents (list[string]). Best used with `count` expressions.

Should it actually be manifests or?

@rverchere
Copy link

Hi,

Prefer using:

for_each   = data.kubectl_path_documents.sa_manifests_docs.manifests
yaml_body  = each.value

Which produces a human readable resource, i.e. kubectl_manifest.sa_manifests["/api/v1/namespaces/kube-system/serviceaccounts/gitlab"]

Instead of:

for_each   = toset(data.kubectl_path_documents.sa_manifests_docs.documents)
yaml_body  = each.value

Because it produces an unreadable resource, i.e. kubectl_manifest.sa_manifests["apiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n name: gitlab\n namespace: gitlab\nsubjects:\n - kind: ServiceAccount\n name: gitlab\n namespace: kube-system\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: cluster-admin"]

Should the documentation be updated accordingly?

613andred added a commit to 613andred/terraform-provider-kubectl that referenced this pull request May 11, 2022
Revert gavinbunney#140 as the original documentation was correct
Remove invalid argument
gavinbunney pushed a commit that referenced this pull request Nov 25, 2024
Revert #140 as the original documentation was correct
Remove invalid argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubectl_path_documents example is incorrect
4 participants