1 unstable release
0.1.0 | May 19, 2023 |
---|
#8 in #helm
17KB
293 lines
y2hcl
a CLI Tool to convert Yaml values file (e.g. Helm Chart Values) to the following format:
- Helm cli set values, e.g.
--set some.var="somevalue"
- Terraform
helm_release
providerset_value
- Terraform
helm_release
providersensitive_value
- HCL variable of type map, e.g.
some_map = {"some.var" = "somevalue"}
Installation
You can install this using the cargo install command:
$ cargo install y2hcl
Usage
$ y2hcl --help
Convert Helm Chart Values yaml to Terraform helm_release set_value, Helm Cli --set values etc.
Usage: y2hcl --filename <FILENAME> --output-format <OUTPUT_FORMAT>
Options:
-f, --filename <FILENAME> Filename or full path to YAML formated Helm Chart values
-o, --output-format <OUTPUT_FORMAT> Output format is how we want our Helm Chart values to look like. Supported format are `hcl_map`, `set_value`, `sensitive_value`, `helm_cli`
-h, --help Print help
-V, --version Print version
Examples
For example, a file values.yaml
contains the following:
livenessProbe:
httpGet:
path: /user/login
port: http
initialDelaySeconds: 120
- YAML values to
HCL Map
$ y2hcl -f values.yaml -o hcl_map
hcl_map = {
"livenessProbe.httpGet.path" = "/user/login"
"livenessProbe.httpGet.port" = "http"
"livenessProbe.initialDelaySeconds" = "120"
}
- YAML values to
helm_release
set_value
$ y2hcl -f values.yaml -o set_value
set_value = {
name = "livenessProbe.httpGet.path"
value = "/user/login"
}
set_value = {
name = "livenessProbe.httpGet.port"
value = "http"
}
set_value = {
name = "livenessProbe.initialDelaySeconds"
value = "120"
}
- YAML values to
helm_release
sensitive_value
$ y2hcl -f values.yaml -o sensitive_value
sensitive_value = {
name = "livenessProbe.httpGet.path"
value = "/user/login"
}
sensitive_value = {
name = "livenessProbe.httpGet.port"
value = "http"
}
sensitive_value = {
name = "livenessProbe.initialDelaySeconds"
value = "120"
}
- YAML values to
Helm CLI
set values
$ y2hcl -f values.yaml -o helm_cli
--set livenessProbe.httpGet.path="/user/login" \
--set livenessProbe.httpGet.port="http" \
--set livenessProbe.initialDelaySeconds="120" \
Dependencies
~3.5MB
~73K SLoC