terraform-aws-modules / terraform-aws-lambda

Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless combinations πŸ‡ΊπŸ‡¦
https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws
Apache License 2.0
885 stars 658 forks source link

Windows: The process cannot access the file because it is being used by another process. #587

Open Ananym opened 1 week ago

Ananym commented 1 week ago

I see this was supposedly fixed in https://github.com/terraform-aws-modules/terraform-aws-lambda/issues/29 , but I'm still seeing it. Could definitely be user error.

Version 7.7.0 on windows, specifying some manual commands in source_path (e.g. tsc), but no matter how I modify the commands, package.py fails with "The process cannot access the file because it is being used by another process.", which I'm guessing must be the zip file itself.

If there's no easy way to get :zip working on windows, is there a way I can specify a zip file I build using the manual commands?

Ananym commented 1 week ago

Forgot to be specific; this is a node build from typescript, so my command is a script that installs npm dev modules, runs tsc, copies some other files into /dist, and installs prod modules in dist.

Did figure out that the \n command join wasn't going to work on windows - it seems fine to just run a script instead as the single working command, but took me a moment to work out what was going on.

Ananym commented 6 days ago

I tried using a localexec null resource as a dependency, but since the module won't run at all if local_existing_package is defined alongside build instructions (even if local_existing_package is defined as null, seemingly) it's very hard to achieve a cross-platform config without getting super contrived

Ananym commented 6 days ago

Rather, the error being hit is β”‚ Error: Invalid combination of arguments β”‚ β”‚ with module.v9-usage-metrics.aws_lambda_function.this[0], β”‚ on .terraform\modules\v9-usage-metrics\main.tf line 57, in resource "aws_lambda_function" "this": β”‚ 57: s3_bucket = local.s3_bucket β”‚ β”‚ "s3_bucket": only one of filename,image_uri,s3_bucket can be specified, but filename,s3_bucket were specified.

is uploading a local_existing_package to s3 not possible?