AWS Lambda功能与地形



在应用地形图时遇到了一些问题,无法确定问题所在。我想尽一切办法。这是我的lambda.tf文件:

data "archive_file" "projectLeo_listunsubscribe_lambda_code" {
type        = "zip"
source_dir  = "${path.module}/../src/ProjectLeo.ListUnsubscribe"
output_path = "${path.module}/../src/code-packaged/list-unsubscribe.zip"
}
resource "aws_lambda_function" "projectLeot_list_unsubscribe_lambda" {
filename                       = "${data.archive_file.projectLeo_listunsubscribe_lambda_code.output_path}"
function_name                  = "projectLeo-listunsubscribe-lambda"
role                           = "${aws_iam_role.projectLeo_list_hygiene_role.arn}"
handler                        = "${var.lambda_list_unsubscribe_function_handler}"
runtime                        = "dotnetcore2.1"
memory_size                    = "256"
timeout                        = 120
publish                        = true
reserved_concurrent_executions = 1
environment {
variables = {
optout-topic-arn = "${data.aws_sns_topic.projectLeo_optout_topic.arn}"
}
}
}
data "aws_sns_topic" "projectLeo_optout_topic" {
name = "${var.sns_optout_topic_name}"
}

生成的计划看起来很好,但这个错误是在应用完成时生成的:

Error: Error creating Lambda function: ValidationException:
status code: 400, request id: c16dc369-bccd-418d-a2b5-2d0383c66064
on ..list-unsubscribeinfrastructurelambda.tf line 9, in resource "aws_lambda_function" "projectLeo_list_unsubscribe_lambda":
9: resource "aws_lambda_function" "projectLeo_list_unsubscribe_lambda" {

这是一个相当轻松的日志,我尝试过逐段更新代码,但总是得到相同的结果。

有人能帮我找出我的代码可能出了什么问题吗?谢谢

最终确定了问题:AWS lambda函数中的环境变量不接受连字符(-(。我用下划线代替了它,它通过了。

optout主题arn变为optout_topic_arn

相关内容

  • 没有找到相关文章

最新更新