I am wondering if achieving something like this is possible on terraform.
My environments.tf file where workspace variables are defined for each environment:
locals {
env = {
test = {
ingress = {
[...]
cidr_blocks = "${local.workspace.pro.vpc.cidr}"
}
}
pro = {
vpc = {
cidr = "10.0.0.0/16"
[...]
}
}
}
I would like to reference a hardcoded variable from the pro workspace. It is not viable the need to change the things on two sides when the values are the same.
What I have tried:
- Referencing the variable from another workspace using:
local.workspaces["pro"]["vpc"]["cidr"]
local.workspace.pro.vpc.cidr
What I expect:
- Grabbing the vpc cidr from the
proworkspace and pass it to thetestworkspace.