We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug For certain map types, toJson fails to render valid json.
toJson
To Reproduce
boilerplate.yml
variables: - name: FirewallRules description: List of firewall rule. type: list default: []
_input_vars.yml
FirewallRules: - "name" : "densbx-allow-internal" "deny" : [ ] "log_config": - "metadata : INCLUDE_ALL_METADATA" "allow": - protocol: "tcp" ports: - 22 - 443 - protocol: "udp" ports: - 53 - protocol: "icmp" ports: - "name" : "densbx-allow-internal" "deny" : [ ] "log_config": - "metadata : INCLUDE_ALL_METADATA" "allow": - protocol: "tcp" ports: - 22 - 443 - protocol: "udp" ports: - 53 - protocol: "icmp" ports:
template.hcl
inputs = { rules = [ {{- range $rule, $config := .FirewallRules }} { {{ range $key, $value := $config }} {{ $key }} = jsondecode("{{ $value | toJson }}") {{- end }} }, {{- end -}} ] }
Expected behavior When rendering this out, we should get valid json output for each entry, but the allow key results in an empty list:
allow
actual rendered:
inputs = { rules = [ { allow = jsondecode("") deny = jsondecode("[]") log_config = jsondecode("["metadata : INCLUDE_ALL_METADATA"]") name = jsondecode(""densbx-allow-internal"") }, { allow = jsondecode("") deny = jsondecode("[]") log_config = jsondecode("["metadata : INCLUDE_ALL_METADATA"]") name = jsondecode(""densbx-allow-internal"") },] }
Currently we can work around it by using yaml at the top e.g.
inputs = { rules = yamldecode(<<EOF {{ .FirewallRules | toYaml }} EOF ) }
But we should figure out why json rendering doesn't work.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
For certain map types,
toJson
fails to render valid json.To Reproduce
boilerplate.yml
_input_vars.yml
template.hcl
Expected behavior
When rendering this out, we should get valid json output for each entry, but the
allow
key results in an empty list:actual rendered:
Currently we can work around it by using yaml at the top e.g.
But we should figure out why json rendering doesn't work.
The text was updated successfully, but these errors were encountered: