cloudposse / cloudposse/terraform-provider-utils

Add method to load multi-yaml document

Open
#331 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
112
Forks
19
Avg merge
7h 14m
Merged PRs (30d)
2

Description

### 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 https://github.com/hashicorp/terraform/issues/29729

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.