milliHQ / terraform-aws-next-js-image-optimization

A drop-in image optimization loader for Next.js image component powered by AWS Lambda.
https://registry.terraform.io/modules/milliHQ/next-js-image-optimization/aws
Apache License 2.0
105 stars 18 forks source link

Permissions issue on hosted Terraform #140

Closed joecritch closed 2 years ago

joecritch commented 2 years ago

I think I've come across a situation where this module isn't compatible with some particular Terraform permissions.

with module.next_image_optimizer.module.lambda_content.data.external.download
on .terraform/modules/next_image_optimizer.lambda_content/main.tf line 35, in data "external" "download"
The data source received an unexpected error while attempting to find the program.
The program must be accessible according to the platform where Terraform is running.

I have a feeling debug_use_local_packages config option may help here, but I'm unsure of how I would build the files without having the project locally.

I appreciate this is a help request rather than a bug, but any ideas are welcome.

ofhouse commented 2 years ago

Building the project locally requires that you have a system that is similar to the Lambda environment (Linux/x64). The easiest way to build the application is to use GitHub Codespaces: Screenshot 2022-07-13 at 13 31 59

When running yarn build from the project root, it should generate a dist.zip in the /lib folder that you can download and copy to a local repository when using debug_use_local_packages.

joecritch commented 2 years ago

@ofhouse Great thank you, I'll take a look!