Hi All,
I’ve been trying to keep my module sources DRY by storing all module configuration (git repo URL and version number) in a single yaml file and then referencing this file in the source parameter of each module I call. I realized that you can’t do this in terraform, so I opened a feature request here to add this capability.
Essentially, I’d like to be able to call a module with variables for the repo and reference, like this:
modules.yaml
:
foo:
repo: git@github.com:myfoomodule.git
reference: v1.4.0
locals.tf
:
module_configs = yamldecode(file("modules.yaml"))
main.tf
:
module "foo" {
source = "${local.module_configs["foo"]["repo"]}?ref=${local.module_configs["foo"]["reference"]}"
...
}
Is there a way to do this, or something similar, in terragrunt?