module "lambda" {
  for_each = local.lambdas
  source   = "../modules/lambda"

  providers = {
    aws = aws.aws
  }

  function_name = each.value.function_name
  handler       = each.value.handler
  runtime       = each.value.runtime
  package       = each.value.package
  iam_role      = each.value.role

  vpc_subnet_ids         = module.vpc.private_subnets
  vpc_security_group_ids = [each.value.security_group_ids]

  source_code_hash = filebase64sha256(each.value.package)
}
