next-js

dealmore/next-js/aws

Terraform Module HCL AWS

Terraform module for building and deploying Next.js apps to AWS. Supports SSR (Lambda), Static (S3) and API (Lambda) pages.

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

Terraform Next.js module for AWS !CI status A zero-config Terraform module for self-hosting Next.js sites serverless on AWS Lambda. Features Some features are still under development, here is a list of features that are currently supported and what we plan to bring with the next releases: - ✅  Next.js v9.5+ & v10+ _(older Versions might work but are not actively supported)_ - ✅  Terraform v0.13+ - ✅  Static, SSG, Lambda and API pages (with dynamic routes) - ✅  Automatic expiration of old static assets - ✅  Rewrites & Redirects - ✅  Image Component & Image Optimization support - 🚧  Incremental Static Regeneration - 🚧  AWS CodeDeploy Architecture The Next.js Terraform module is designed as a full stack AWS app. It relies on multiple AWS services and co

Inputs (28)
NameTypeDescriptionDefault
cloudfront_external_idstringWhen using an external CloudFront distribution provide its id. required
domain_namestringThis is used to figure out which preview deployment to route to. required
cloudfront_acm_certificate_arnstringACM certificate arn for custom_domain 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 required
cloudfront_external_arnstringWhen using an external CloudFront distribution provide its arn. required
multiple_deploymentsboolHave multiple deployments and domain aliases.false
next_tf_dirstringRelative path to the .next-tf dir."./.next-tf"
lambda_environment_variablesmap(string)Map that defines environment variables for the Lambda Functions in Next.js.{}
lambda_timeoutnumberMax amount of time a Lambda Function has to return a response in seconds. Should10
vpc_subnet_idslist(string)The list of VPC subnet IDs to attach the Lambda functions. lambda_attach_to_vpc []
vpc_security_group_idslist(string)The list of Security Group IDs to be used by the Lambda functions. lambda_attach[]
cloudfront_create_distributionboolControls whether the main CloudFront distribution should be created.true
cloudfront_cache_key_headerslist(string)Header keys that should be used to calculate the cache key in CloudFront.[ "Authorization" ]
image_optimization_lambda_memory_sizenumberAmount of memory in MB the worker Lambda Function for image optimization can use2048
use_awscli_for_static_uploadboolUse AWS CLI when uploading static resources to S3 instead of default Bash scriptfalse
deployment_namestringIdentifier for the deployment group (alphanumeric characters, underscores, hyphe"tf-next"
expire_static_assetsnumberNumber of days after which static assets from previous deployments should be rem30
lambda_memory_sizenumberAmount of memory in MB a Lambda Function can use at runtime. Valid value between1024
lambda_attach_to_vpcboolSet to true if the Lambda functions should be attached to a VPC. Use this settinfalse
tagsmap(string)Tag metadata to label AWS resources that support tags.{}
debug_use_local_packagesboolUse locally built packages rather than download them from npm.false
lambda_runtimestringLambda Function runtime"nodejs14.x"
create_image_optimizationboolControls whether resources for image optimization support should be created or ntrue
cloudfront_minimum_protocol_versionstringThe minimum version of the SSL protocol that you want CloudFront to use for HTTP"TLSv1"
cloudfront_origin_headerslist(string)Header keys that should be sent to the S3 or Lambda origins. Should not contain []
Outputs (8)
cloudfront_domain_name — Domain of the main CloudFront distribution (When created).
cloudfront_hosted_zone_id — Zone id of the main CloudFront distribution (When created).
cloudfront_default_root_object — Preconfigured root object the CloudFront distribution should use.
cloudfront_default_cache_behavior — Preconfigured default cache behavior the CloudFront distribution should use.
cloudfront_ordered_cache_behaviors — Preconfigured ordered cache behaviors the CloudFront distribution should use.
cloudfront_origins — Preconfigured origins the CloudFront distribution should use.
cloudfront_custom_error_response — Preconfigured custom error response the CloudFront distribution should use.
static_upload_bucket_id
Resources (9)
aws_cloudfront_cache_policyaws_cloudfront_origin_request_policyaws_cloudwatch_log_groupaws_iam_policyaws_iam_roleaws_iam_role_policy_attachmentaws_lambda_functionaws_lambda_permissionrandom_id
Details
FrameworkTerraform Module
LanguageHCL
Version1.0.0-canary.1
Cloud AWS
★ Stars1.5k
Forks151
Total downloads38.4k
Inputs28
Outputs8
Resources9
Examples5
Submodules4
LicenseApache-2.0
Namespacedealmore
Updated