Originally created by @garysassano on GitHub (May 10, 2024).
While Pkl currently supports various formats like json and yaml, direct output in hcl would be a powerful addition for Terraform users.
Although generating HCL through intermediary formats like YAML or JSON is technically possible using HCL's yamldecode and jsondecode functions, it introduces unnecessary complexity. Direct HCL output would significantly streamline the workflow for creating .tfvars files used in Terraform configurations.
This feature would eliminate conversion steps, reduce potential errors, and solidify Pkl's position as a valuable tool within the Terraform ecosystem.
Originally created by @garysassano on GitHub (May 10, 2024).
While Pkl currently supports various formats like `json` and `yaml`, direct output in `hcl` would be a powerful addition for Terraform users.
Although generating HCL through intermediary formats like YAML or JSON is technically possible using HCL's [yamldecode](https://developer.hashicorp.com/terraform/language/functions/yamldecode) and [jsondecode](https://developer.hashicorp.com/terraform/language/functions/jsondecode) functions, it introduces unnecessary complexity. Direct HCL output would significantly streamline the workflow for creating `.tfvars` files used in Terraform configurations.
This feature would eliminate conversion steps, reduce potential errors, and solidify Pkl's position as a valuable tool within the Terraform ecosystem.
See also #59
We don't plan to generate higher-level languages from Pkl. You can, of course, define your own renderers (see the TOML and CSV renderers, for example).
The problem is that we can't "inspect" constructs that change under evaluation (for/when/if/etc). We only render static output.
I have used Terraform's tf.json format quite a lot without any problems or notable "added complexity." Using it from HCL might add the extra indirection, but I just do everything in tf.json and forget about HCL altogether.
@holzensp commented on GitHub (Jun 25, 2024):
We don't plan to generate higher-level languages from Pkl. You can, of course, define your own renderers (see the [TOML](https://pkl-lang.org/package-docs/pkg.pkl-lang.org/pkl-pantry/pkl.toml/current/toml/Renderer.html) and [CSV](https://pkl-lang.org/package-docs/pkg.pkl-lang.org/pkl-pantry/pkl.csv/current/csv/Renderer.html) renderers, for example).
The problem is that we can't "inspect" constructs that change under evaluation (`for`/`when`/`if`/etc). We only render static output.
I have used Terraform's `tf.json` format quite a lot without any problems or notable "added complexity." Using it _from HCL_ might add the extra indirection, but I just do _everything_ in `tf.json` and forget about HCL altogether.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @garysassano on GitHub (May 10, 2024).
While Pkl currently supports various formats like
jsonandyaml, direct output inhclwould be a powerful addition for Terraform users.Although generating HCL through intermediary formats like YAML or JSON is technically possible using HCL's yamldecode and jsondecode functions, it introduces unnecessary complexity. Direct HCL output would significantly streamline the workflow for creating
.tfvarsfiles used in Terraform configurations.This feature would eliminate conversion steps, reduce potential errors, and solidify Pkl's position as a valuable tool within the Terraform ecosystem.
See also #59
@holzensp commented on GitHub (Jun 25, 2024):
We don't plan to generate higher-level languages from Pkl. You can, of course, define your own renderers (see the TOML and CSV renderers, for example).
The problem is that we can't "inspect" constructs that change under evaluation (
for/when/if/etc). We only render static output.I have used Terraform's
tf.jsonformat quite a lot without any problems or notable "added complexity." Using it from HCL might add the extra indirection, but I just do everything intf.jsonand forget about HCL altogether.