So, you basically "re-declare" when you define/invoke the submodule. See: https://stackoverflow.com/questions/53853790/terraform-how-to-pass-environment-variables-to-sub-modules-in-terraform
In my case, I'm building "N" VMs in submodules and there is a "vms.tf" that has the "module "NAME" {} invocation (and of course there are "N" of these) so I had to do something like:
module "FIRST" {variableone = var.variableone}
.
.
.
module "NTH" {variableone = var.variableone}
"N" times and then at the top level (main.tf or variables.tf) something like:
export variableone="myvaluegoeshere"
variable "variableone" {and then
description = "Cascade environment variable in terraform"
default = ""}
export variableone="myvaluegoeshere"
in my environment.
No comments:
Post a Comment