gruntwork-io / pre-commit

A collection of pre-commit hooks used by Gruntwork tools
https://gruntwork.io/
Apache License 2.0
484 stars 155 forks source link

Ability to pre-generate terraform code with terragrunt before validation #114

Open wyardley opened 2 months ago

wyardley commented 2 months ago

Describe the solution you'd like It would be nice to be able to pre-generate the terraform code from terragrunt and then validate the outputs, which I don't think is possible / supported here?

Describe alternatives you've considered Just running the vanilla terraform_validate hook, however, if the code depends on generated things like data resources, validation will fail If there's some easy way to do this already, let me know.

Additional context Example failure in a "root" module that depends on a Terragrunt generated data resource

│ Error: Reference to undeclared resource
│ 
│   on main.tf line 11, in resource "google_alloydb_cluster" "this":
│   11:     network = data.terraform_remote_state.network.outputs.network_id
│ 
│ A data resource "terraform_remote_state" "network" has not been declared in
│ the root module.