0

I was following this tutorial for multi-env deployment with Terragrunt in GCP: https://harjot.me/blog/deploying-docker-containers-to-gke-using-terraform/

As you can see he didn't finish the gcp-sql moudule example and now I don't know how do I refer to other resources or outputs that are in a different folders using this template. For instance :

a module in terraform>module>gcp-sql>main.tf

needs a value from terraform>module>gcp-gke>main.tf such as module.gcp_services.project_id

or

it needs a value from terraform>module>gcp-gke>outputs.tf such as module.gke.cluster_endpoint (I'm not even sure this is the correct way to refer to the output, do I really need to specify module name "gke"?)

So in short,using this template from tutorial if a module that is using a value from another module but both modules are in the same main.tf such as erraform>module>gcp-gke>main.tf file then yes I can use module.gcp_services.project_id but will the same apply if the second moudule is in a different main.tf file. If yes, how is it aware of the other module? And again, how do I use outputs?

Serhii Rohoza
  • 4,287
  • 2
  • 16
  • 29
KatranPlague
  • 117
  • 1
  • 12
  • 2
    Have you checked `dependencies` in Terragrunt? It's a way to get output from one module and use it as an input for another module. https://terragrunt.gruntwork.io/docs/features/execute-terraform-commands-on-multiple-modules-at-once/#passing-outputs-between-modules – Max Ivanov Nov 13 '20 at 13:27
  • This is exactly what I need, thanks. – KatranPlague Nov 16 '20 at 08:05

0 Answers0