-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
``` |