【发布时间】:2020-07-04 17:17:11
【问题描述】:
在应用我的 terraform 计划时遇到一些问题,无法确定其中的问题。我尝试了我能想到的一切。这是我的 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-unsubscribe\infrastructure\lambda.tf line 9, in resource "aws_lambda_function" "projectLeo_list_unsubscribe_lambda":
9: resource "aws_lambda_function" "projectLeo_list_unsubscribe_lambda" {
这是一个相当简单的日志,我尝试逐段更新代码,但总是得到相同的结果。
谁能帮我查明我的代码可能有什么问题?谢谢!
【问题讨论】:
-
您是否创建了 aws_iam_role?
-
感谢您回到我身边。是的 IAM 角色已定义,问题出在环境变量本身上,正如我在下面的回答中所解释的那样。
标签: c# amazon-web-services aws-lambda terraform-provider-aws