Sun*_*war 3 aws-lambda terraform terraform-provider-aws
我正在使用 terraform 创建 lambda 函数,根据 terraform 语法 lambda 代码应作为 zip 文件传递。以类似的方式,我传入一个资源块,并且它的创建也没有任何问题。但是当我尝试在下次运行中使用 terraform 更新 lambda 代码时,它没有得到更新。下面的块供参考。
data "archive_file" "stop_ec2" {
type = "zip"
source_file = "src_dir/stop_ec2.py"
output_path = "dest_dir/stop_ec2_upload.zip"
}
resource "aws_lambda_function" "stop_ec2" {
function_name = "stopEC2"
handler = "stop_ec2.handler"
runtime = "python3.6"
filename = "dest_dir/stop_ec2_upload.zip"
role = "..."
}
Run Code Online (Sandbox Code Playgroud)
需要帮助来解决此问题。
设置source_code_hash参数,以便 Terraform 在 lambda 代码更改时更新 lambda 函数。
resource "aws_lambda_function" "stop_ec2" {
source_code_hash = filebase64sha256("dest_dir/stop_ec2_upload.zip")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3466 次 |
| 最近记录: |