diff --git a/main.tf b/main.tf index 818795f..933df0d 100644 --- a/main.tf +++ b/main.tf @@ -11,7 +11,7 @@ locals { } module "lambda_role" { - count = length([var.role_arn]) == 0 ? 1 : 0 + count = length(compact([var.role_arn])) == 0 ? 1 : 0 source = "github.com/schubergphilis/terraform-aws-mcaf-role?ref=v0.3.3" name = join("-", compact([var.role_prefix, "LambdaRole", var.name])) @@ -140,7 +140,7 @@ resource "aws_lambda_function" "default" { memory_size = var.memory_size publish = var.publish reserved_concurrent_executions = var.reserved_concurrency - role = length([var.role_arn]) > 0 ? var.role_arn : module.lambda_role[0].arn + role = length(compact([var.role_arn])) > 0 ? var.role_arn : module.lambda_role[0].arn runtime = var.runtime s3_bucket = var.s3_bucket s3_key = var.s3_key diff --git a/outputs.tf b/outputs.tf index a701bcc..526bfa0 100644 --- a/outputs.tf +++ b/outputs.tf @@ -19,7 +19,7 @@ output "qualified_arn" { } output "role_arn" { - value = length([var.role_arn]) > 0 ? var.role_arn : module.lambda_role[0].arn + value = length(compact([var.role_arn])) > 0 ? var.role_arn : module.lambda_role[0].arn description = "ARN of the lambda execution role" }