next-js-image-optimization

dealmore/next-js-image-optimization/aws

Terraform Module HCL AWS

A drop-in image optimization loader for Next.js image component powered by AWS Lambda.

Install
module "next-js-image-optimization" {
source = "dealmore/next-js-image-optimization/aws"
version = "12.0.10"
}
plain text: /constructs/tfmod-dealmore-next-js-image-optimization-aws/install.txt
⭐ Source on GitHub 📦 Registry page
README

Terraform Next.js Image Optimization module for AWS ![CI](https://github.com/milliHQ/terraform-aws-next-js-image-optimization/actions/workflows/CI.yml) A drop-in image optimization loader for the Next.js image component next/image. > Notice: If you look for a complete solution to host a Next.js application with Terraform on AWS, please check out our Terraform Next.js module for AWS. Features - ✅  Terraform v0.13+ - ✅  Serverless image processing powered by AWS Lambda - ✅  Powerful optimization using the sharp processing library - ✅  Performant image caching powered by Amazon CloudFront - ✅  Two-layer caching with CloudFront Origin Shield - ✅  Support for custom Device Sizes & Image Sizes Architecture The image optimization module is designed as a full stack AW

Inputs (20)
NameTypeDescriptionDefault
next_image_image_sizeslist(number)Allowed image sizes that should be used for image optimization. required
source_bucket_idstringWhen your static files are deployed to a Bucket (e.g. with Terraform Next.js) th required
next_image_device_sizeslist(number)Allowed device sizes that should be used for image optimization. required
next_image_base_originstringBase URL where requests for absolute image paths should be resolved to. Should n required
lambda_role_permissions_boundarystringARN of IAM policy that scopes aws_iam_role access for the lambda. required
lambda_policy_jsonstringAdditional policy document as JSON to attach to the Lambda Function role.""
debug_use_local_packagesbool(Debug) Use local packages instead of downloading them from npm.false
lambda_memory_sizenumberAmount of memory in MB the worker Lambda Function can use. Valid value between 11024
lambda_attach_policy_jsonboolControls whether lambda_policy_json should be added to IAM role for Lambda functfalse
cloudfront_origin_shield_regionstringOverride the region choosen for the CloudFront origin shield. Use `auto` to auto"auto"
deployment_namestringIdentifier for the deployment group (only lowercase alphanumeric characters and "tf-next-image"
next_image_versionstringNext.js version from where you want to use the image optimizer from. Supports se"12.0.10"
next_image_formatslist(string)If the Accept head matches more than one of the configured formats, the first ma[ "image/webp" ]
cloudfront_price_classstringPrice class for the CloudFront distribution. One of PriceClass_All, PriceClass_2"PriceClass_100"
cloudfront_enable_origin_shieldboolControls whether CloudFront Origin Shield should be enabled on the image optimiztrue
cloudfront_origin_idstringOverride the id for the custom CloudFront id."tf-next-image-optimizer"
next_image_domainslist(string)Allowed origin domains that can be used for fetching images.[]
cloudfront_create_distributionboolControls whether a CloudFront distribution should be created.true
lambda_timeoutnumberMax amount of time the worker Lambda Function has to return a response in second30
tagsmap(string)Tag metadata to label AWS resources that support tags.{}
Outputs (7)
cloudfront_cache_policy_id — Cache policy id used for image optimization.
cloudfront_domain_name — Domain of the internal CloudFront distribution.
cloudfront_hosted_zone_id — Zone id of the internal CloudFront distribution.
cloudfront_origin_id — Id of the custom origin used for image optimization.
cloudfront_origin — Predefined CloudFront origin. Can be used to embed the image optimizer into an existing CloudFront r
cloudfront_cache_behavior — Predefined CloudFront cache behavior. Can be used to embed the image optimizer into an existing Clou
cloudfront_origin_request_policy_id — Request policy id used for image optimization.
Resources (2)
aws_cloudfront_cache_policyaws_cloudfront_origin_request_policy
Details
FrameworkTerraform Module
LanguageHCL
Version12.0.10
Cloud AWS
★ Stars110
Forks19
Total downloads37.6k
Inputs20
Outputs7
Resources2
Examples3
Submodules1
LicenseApache-2.0
Namespacedealmore
Updated