I have two lambdas in my terraform configuration and I want them to have the exact same environment variables.
I'd like to not need to modify both lambda environment blocks every time I modify one. Is it possible to have some kind of a reusable block?
So instead of this:
resource "aws_lambda_function" "f1" {
<..>
environment {
variables = {
ENV_STAGE = "${lower(var.environment)}" # all of these will always be same for both lambdas
A = "A"
}
}
}
resource "aws_lambda_function" "f2" {
<..>
environment {
variables = {
ENV_STAGE = "${lower(var.environment)}"
A = "A"
}
}
}
It would be something like this:
env = {
variables = {
ENV_STAGE = "${lower(var.environment)}"
A = "A"
}
}
resource "aws_lambda_function" "f1" {
<..>
environment = env
}
resource "aws_lambda_function" "f2" {
<..>
environment = env
}