Merging two maps in Terraform
Is as simple as using merge function:
resource "aws_lambda_function" "example" {
# ...
environment {
variables = merge(
var.extra_envs,
{
EXISTING_ENV = "hello"
},
)
}
when using the module:
extra_envs = {
OTHER = "world"
}
var.extra_envs
is a map(string)
type here.