How can i map the environment variable to the source to make it dynamic .so this will pick the files dynamically based on each environment folder
module “logic_apps” {
source = “./modules/logic-apps/dev”
module "logic_apps" {
source = "./modules/logic-apps/${var.stage}"
Hi @vmaharajan2006,
This is not possible in Terraform. The configuration source, and hence all modules, need to be statically loaded before Terraform can do any evaluation. If you want to change the source value, you would need to generate the config files from some sort of template externally.
In most situations, rather than the module being changed out based on a variable, which would make static analysis impossible, modules are designed around taking inputs which change the behavior based on the desired conditions. So rather than having multiple /modules/logic-apps
modules, you would have a single module which can take inputs which could be based on var.stage
.