简体   繁体   中英

Terraform Update an existing Lambda function was created on AWS console

I want to update a my code on Lambda function.

I previous creating lambda function on aws console.

I do a creating terraform code for update my function existing but I received an error

I try using this block code

data "archive_file" "stop_ec2" {
  type        = "zip"
  source_file = "src_dir/stop_ec2.py"
  output_path = "dest_dir/stop_ec2_upload.zip"
}

data "aws_lambda_function" "existing" {
  function_name = MyPocLambda
  role          = aws_iam_role.iam_for_lambda.arn
  filename      = "dest_dir/stop_ec2_upload.zip"
  source_code_hash ="${data.archive_file.stop_ec2.output_base64sha256}"

}

My error says filename unsupported argument, filename is not expected here

it possible update lambda function using terafform data ?

You have to import your lambda function to TF first. Then you will be able to modify it using TF code using aws_lambda_function resource, not data source.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM