【发布时间】:2021-05-13 16:23:27
【问题描述】:
我正在尝试使用 terraform 脚本创建 lambda 函数 我收到错误消息“创建 lambda 函数时出错”我也把错误的屏幕截图
这是地形脚本:
我在 AWS 管理控制台中创建了一个角色,并命名为“Welcome-Lambda-Role”。这就是我在下面的脚本中提到的那个角色。不知道是不是这个问题。
provider "aws" {
region = "us-west-2"
access_key = "xxz"
secret_key = "yyyydtEyZtOaQVGF5h"
}
data "archive_file" "welcome" {
type = "zip"
source_file = "welcome.py"
output_path = "outputs/welcome.zip"
}
resource "aws_lambda_function" "test_lambda" {
filename = "outputs/welcome.zip"
function_name = "welcome"
handler = "welcome.hello"
//created this role manually in AWS console and referred to that role in the next line
role = "Welcome-Lambda-Role"
//source_code_hash = filebase64sha256("lambda_function_payload.zip")
runtime = "python3.7"
}
welcome.py 文件内容
def hello(event, context):
print("Welcome to terraform")
【问题讨论】:
标签: terraform terraform-provider-aws