skip to Main Content

I’m trying to deploy a lambda function using s3 in terraform(v1.8.1). I named s3 bucket there however, I couldn’t add s3_key as i got an error saying it is not expected there.
following is my code

module "lambda_function"{
  source  = "terraform-aws-modules/lambda/aws"
  local_existing_package = "${path.root}/${module.package.local_filename}"
    
  function_name = local.name
  description   = var.lambda_description
  handler       = var.lambda_handler
  runtime       = "nodejs20.x"
  store_on_s3 = true
  s3_bucket   = var.lambda_s3_bucket
}

For this I’m getting "s3_bucket": only one of filename,image_uri,s3_bucket can be specified, but filename,s3_bucket were specified.I tried to add nulls for filename,image_uri it also didn’t work. Please let me know how to fix this.

2

Answers


  1. Chosen as BEST ANSWER

    this error was due to local_existing_package


  2. You cannot use s3_key as that is a local variable which is derived, among other variables, from s3_prefix. So you would need to use s3_prefix instead.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search