diff --git a/docs/plugins/builtin/data-sources/yaml.md b/docs/plugins/builtin/data-sources/yaml.md new file mode 100644 index 00000000..110d8e8d --- /dev/null +++ b/docs/plugins/builtin/data-sources/yaml.md @@ -0,0 +1,75 @@ +--- +title: "`yaml` data source" +plugin: + name: blackstork/builtin + description: "Loads YAML files with the names that match provided `glob` pattern or a single file from provided `path`value" + tags: [] + version: "v0.4.2" + source_github: "https://github.com/blackstork-io/fabric/tree/main/internal/builtin/" +resource: + type: data-source +type: docs +--- + +{{< breadcrumbs 2 >}} + +{{< plugin-resource-header "blackstork/builtin" "builtin" "v0.4.2" "yaml" "data source" >}} + +## Description +Loads YAML files with the names that match provided `glob` pattern or a single file from provided `path`value. + +Either `glob` or `path` argument must be set. + +When `path` argument is specified, the data source returns only the content of a file. +When `glob` argument is specified, the data source returns a list of dicts that contain the content of a file and file's metadata. For example: + +```yaml +[ + { + "file_path": "path/file-a.yaml", + "file_name": "file-a.yaml", + "content": { + "foo": "bar" + } + }, + { + "file_path": "path/file-b.yaml", + "file_name": "file-b.yaml", + "content": [ + {"x": "y"} + ] + } +] +``` + +The data source is built-in, which means it's a part of `fabric` binary. It's available out-of-the-box, no installation required. + +## Configuration + +The data source doesn't support any configuration arguments. + +## Usage + +The data source supports the following execution arguments: + +```hcl +data yaml { + # A glob pattern to select YAML files to read + # + # Optional string. + # For example: + # glob = "path/to/file*.yaml" + # + # Default value: + glob = null + + # A file path to a YAML file to read + # + # Optional string. + # For example: + # path = "path/to/file.yaml" + # + # Default value: + path = null +} +``` \ No newline at end of file