hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.79k stars 443 forks source link

CLI: Missing `--hcl` option for `cdktf deploy` #3582

Open garysassano opened 3 months ago

garysassano commented 3 months ago

Expected Behavior

Currently, it's not possible to directly deploy your CDKTF application from the CLI if you're using the HCL output.

You're left with two options:

It should be possible to execute cdktf deploy --hcl directly.

Actual Behavior

See above.

Steps to Reproduce

See above.

Versions

0.20.5

Providers

No response

Gist

No response

Possible Solutions

No response

Workarounds

No response

Anything Else?

No response

References

No response

Help Wanted

Community Note

DanielMSchmidt commented 3 months ago

Could you expand on why the format is important to you? The content of both versions should be the same, so if you deploy right away there should be no difference between the JSON and HCL from Terraforms point of view.

garysassano commented 3 months ago

It would be useful for validating the resulting configuration when debugging, since HCL is easier to read for a human.

oieduardorabelo commented 2 months ago

sharing my notes here:

another thing I noticed,

tools like aquasecurity/trivy, aquasecurity/tfsec and bridgecrewio/checkov

they all work better with HCL than with JSON

in my case, i do execute cdktf synth --hcl and cdktf deploy --skip-synth separately

sescotti commented 1 week ago

as a workaround you could use SYNTH_HCL_OUTPUT=true cdktf deploy as used here

disclosure: in my case it doesn't work properly since it's not printing any of the attributes (json output works fine)