0

Looking at this example project from Gruntwork, https://github.com/gruntwork-io/terragrunt-infrastructure-live-example, but tweaking it for GCP instead.

I want my project to create it's own GCP project via a module and I then want the rest of the modules to use this information much like the above example uses the account information. However, I don't want to put a dependency in all the other modules manually, so I how can I apply this via the main terragrunt.hcl file?

Edit: After trying around a bit more, I don't think this is possible with the way terragrunt currently works, as it seems that the dependency needs to be hardcoded into the terragrunt.hcl file for the module.

lobbin
  • 127
  • 1
  • 12
  • Just realised I might run into a chicken-and-egg issue as the remote state is to be stored in a bucket in a project that doesn't exist. – lobbin Mar 03 '21 at 10:12

1 Answers1

0

You can't generate hcl files and then use them in the same terragrunt apply run.

But you can generate for example github repo via terraform - on the GCP project creation phase. Initialize repo from template (github has notion of repo templates), then generate everything you need there: terraform and terragrunt files via github file resource. And then you can use that repo for managing your infra. Updates to generated files will be possible later also.

https://registry.terraform.io/providers/integrations/github/latest/docs