tfutils/tfscaffold

Add support for terraform format and validate

Closed this issue · 6 comments

Tools are increasing popular and we like to fail fast can you add support for "terraform fmt" and "terraform validate"

https://developer.hashicorp.com/terraform/cli/commands/fmt

https://developer.hashicorp.com/terraform/cli/commands/validate

These commands are both implicitly supported by the 'generic action' support. No var file args will be passed as these commands do not support the passing of var files. Have you tried passing -a fmt or -a validate to tfscaffold?

I haven't, will this do the validate for specific components?

Yes, all actions are performed at component level before cding back to the original execution location.

So can the same work to use checkov, TF sec or TF lint? Or is that just terraform args?

tfscaffold just wraps Terraform, what we have done on another project is set up a separate action/step to run checkov against each component, which would be the same for the other tools you have mentioned I would imagine

Could the solution be expanded to take the non terraform commands? It'd be great to see your solution, did you wrap them in pre-commits too?