Hi I am working on something very simple
I am creating a lambda runtime management config to manage all my lambda. I have around 9 existing ones.
resource "aws_lambda_runtime_management_config" "example" {
function_name = aws_lambda_function.[*].function_name
update_runtime_on = "Auto" # Options: Auto, FunctionUpdate, Manual
}
On the required function_name I would like to fetch ALL the ARN's for all my lambda's function.
I know it's very simple and I have a feeling I am making it too difficult for myself> I would appreciate some feedback.
If the update_runtime_on argument needs to have the same value of "Auto", then this should be pretty straightforward. If the Lambda functions were created using the count meta-argument, the code should look something like the following:
resource "aws_lambda_runtime_management_config" "example" {
count = 9 # or whatever count argument you are using when creating the functions
function_name = aws_lambda_function.example[count.index].function_name
update_runtime_on = "Auto" # Options: Auto, FunctionUpdate, Manual
}
If the functions were created using the for_each meta-argument, then you could use resource chaining with for_each:
resource "aws_lambda_runtime_management_config" "example" {
for_each = aws_lambda_function.example
function_name = each.value.function_name
update_runtime_on = "Auto" # Options: Auto, FunctionUpdate, Manual
}