Hi there, I’m new to terraform.
I would like to somehow merge(?) two maps of objects (from 2 different files) with the same name into one map so that terraform could read maps from both files at the same time.
I have the following in my variables.tf
:
variable "virtual_machines" {
type = map(object({
ipv4_address = string
cores = number
memory = number
}))
}
Then I have two files, first is instances-1.auto.tfvars
virtual_machines = {
srv-audit-11 = {
ipv4_address = "172.24.29.2"
cores = 4
memory = 8192
}
}
And another one: instances-2.auto.tfvars
virtual_machines = {
srv-clickhouse-01 = {
ipv4_address = "172.24.28.3"
cores = 4
memory = 8192
}
}
Only the first file is read when I run terraform plan
, the other one seems to be ignored. Any ideas what could be wrong?
Thanks!