terraform-cdk icon indicating copy to clipboard operation
terraform-cdk copied to clipboard

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

Open garysassano opened this issue 4 months ago • 4 comments

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:

  • cdktf deploy, but you get JSON output
  • cdktf synth --hcl followed by cdktf deploy --skip-synth, but you need to use two commands

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

  • [ ] I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

garysassano avatar Apr 04 '24 11:04 garysassano

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.

DanielMSchmidt avatar Apr 08 '24 09:04 DanielMSchmidt

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

garysassano avatar Apr 08 '24 12:04 garysassano

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

oieduardorabelo avatar Apr 29 '24 21:04 oieduardorabelo