terraform-aws-lambda-at-edge
terraform-aws-lambda-at-edge copied to clipboard
Error: in data "archive_file" "zip_file_for_lambda"
terraform -version
Terraform v1.0.11 on darwin_amd64
- provider registry.terraform.io/hashicorp/archive v2.2.0
- provider registry.terraform.io/hashicorp/aws v3.66.0
I get this error when run this command:
terraform init
terraform apply
Error:
with module.redirect_externalurl_lambda.data.archive_file.zip_file_for_lambda, │ on .terraform/modules/redirect_externalurl_lambda/main.tf line 9, in data "archive_file" "zip_file_for_lambda": │ 9: data "archive_file" "zip_file_for_lambda" {
This is my main.tf file
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.65"
}
}
required_version = ">= 0.14.9"
}
provider "aws" {
profile = "default"
region = "us-east-1"
}
module "abcdef_lambda_edge_module" {
source = "transcend-io/lambda-at-edge/aws"
version = "0.4.0"
name = "abcdef_lambda_edge"
description = "Some description..."
runtime = "nodejs14.x"
lambda_code_source_dir = "${path.module}"
s3_artifact_bucket = "abcdef.lambda.deploy"
}
Same here. Unfortunately, the last commit was about half a year ago, so I don't think there will be immediate help.
Check out this blog post to build lambda@edge yourself, from the same authors as this module here: https://transcend.io/blog/lambda-edge-functions-in-terraform
I also encountered this, but this was du to a misunderstanding how the variable lambda_code_source_dir works, or actually that there needs to be a certain structure.
If you check out variables.tf variable file_globs you might see what I mean.<br >
The module basically zips all files in lambda_code_source_dir that match the entries in file_globs. So you either rename your files accordingly or extend the file_globs in the module definition.
However, I'm not sure this module is actively cared for. There is a pull request pending for a while concerning the default runtime and deprecation warnings about the S3 resources are popping up.