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

Add method to load multi-yaml document #331

Open
joaocc opened this issue Oct 4, 2023 · 0 comments
Open

Add method to load multi-yaml document #331

joaocc opened this issue Oct 4, 2023 · 0 comments

Comments

@joaocc
Copy link

joaocc commented Oct 4, 2023

Describe the Feature

When processing k8s yaml files, it's very common that these have multi-document yaml files.
At the moment there are not many general and well supported ways of getting these files into HCL-land.
Since the deep_merge method is also one of the only ways to do a common yaml operation in HCL, I would like to kindly suggest that a method to parse multi-document YAMLs into a list of individual YAMLs (ie, into list(str)).

Expected Behavior

parsing a YAML file (str) into a list of YAMLs (list(str))
if file is already single document, a list with only 1 string will be returned.

Use Case

Processing of k8s manifest files (and flux2 files, and ...)

Describe Ideal Solution

parsing a YAML file (str) into a list of YAMLs (list(str))
if file is already single document, a list with only 1 string will be returned.

Alternatives Considered

There is currently something similar in alekc/kubectl (from gavinbunney/kubectl) in the form of kubectl_file_documents and kubectl_path_documents, but this is not generic YAML.
A discussion on adding similar capabilities to terraform here hashicorp/terraform#29729

Additional Context

No response

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

No branches or pull requests

1 participant