Is there any way to override the default value that is set as locals in the module and in the invocation part?
In module default value looks like this:
module.tf
locals {
default = {
"defaul_instance_1" = {
instance_id = "test_1"
instance_type = "t2.medium"
ami = "ami-1234567"
instance_config = {
ebs = {
"xvdb" = 20
}
},
"defaul_instance_2" = {
instance_id = "test_2"
instance_type = "t2.small"
ami = "ami-1234567"
instance_config = {
ebs = {
"xvdb" = 30
}
},
...
}
variable "instance" {
type = map(string)
}
and in module calling part would like to override any value depending on the case, for example:
module "ec2" {
source = "./module.tf"
instance = local.instance
}
locals {
default = {
"instance" = {
instance_type = "m5.xlarge"
instance_config = {
ebs = {
"xvdb" = 100
}
}
}
Or is there any better way to handle this
Thank you