Skip to content

Commit a8398d7

Browse files
merge commit
2 parents 89a8cef + 908ca73 commit a8398d7

22 files changed

+72
-7942
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
indent_style = space
9+
indent_size = 2
10+
end_of_line = lf
11+
charset = utf-8
12+
trim_trailing_whitespace = true
13+
insert_final_newline = true

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Tag'
8+
required: true
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
# Do a full checkout (all branches)
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: dealmore/[email protected]
20+
with:
21+
upstream-branch: main
22+
release-branch: release
23+
release-tag: ${{ github.event.inputs.tag }}
24+
exclude: '["lib/*", "test/*", "package.json", "yarn.lock"]'

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ node_modules
66
**/.terraform/*
77
*.tfstate
88
*.tfstate.*
9+
10+
# IntelliJ IDEA
11+
/.idea/

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## 10.0.5 (March 15, 2021)
4+
5+
**Note 1:** From now on we aligning the versioning schema with the releases of Next.js.
6+
7+
**Note 2:** When upgrading from a previous release, you may experience an error from Terraform:
8+
9+
```
10+
Error: error updating CloudFront Distribution:
11+
InvalidArgument: The parameter ForwardedValues cannot be used when a cache policy is associated to the cache behavior.
12+
status code: 400
13+
```
14+
15+
This is a known bug in the Terraform AWS provider and may requires a manual upgrade in the AWS Console ([terraform-provider-aws#17626](https://github.com/hashicorp/terraform-provider-aws/issues/17626)).
16+
17+
- Fixes wrong response for repeated requests from external source ([#12](https://github.com/dealmore/terraform-aws-next-js-image-optimization/issues/12), [#13](https://github.com/dealmore/terraform-aws-next-js-image-optimization/pull/13))
18+
- Use Request and Cache Policies in CloudFront distribution ([#5](https://github.com/dealmore/terraform-aws-next-js-image-optimization/issues/5), [#9](https://github.com/dealmore/terraform-aws-next-js-image-optimization/pull/9))
19+
- Upgrades Lambda runtime from `nodejs12.x` to `nodejs14.x`. ([#4](https://github.com/dealmore/terraform-aws-next-js-image-optimization/issues/4), [#8](https://github.com/dealmore/terraform-aws-next-js-image-optimization/pull/8))
20+
321
## 2.0.1 (March 08, 2021)
422

523
- Bump internal module `terraform-aws-modules/apigateway-v2/aws` from `0.8.0` to `0.11.0` ([#16](https://github.com/dealmore/terraform-aws-next-js-image-optimization/pull/16), [#18](https://github.com/dealmore/terraform-aws-next-js-image-optimization/pull/18))

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ If you need a complete hosting solution for Next.js with Terraform, please check
1313
- [Amazon CloudFront](https://aws.amazon.com/cloudfront/) powered image caching
1414
- Support for custom [Device Sizes](https://nextjs.org/docs/basic-features/image-optimization#device-sizes) & [Image Sizes](https://nextjs.org/docs/basic-features/image-optimization#image-sizes)
1515

16+
## Architecture
17+
18+
The image optimization module is designed as a full stack AWS app.
19+
It relies on multiple AWS services and connects them to work as a single application:
20+
21+
![Architecture overview diagram](https://github.com/dealmore/terraform-aws-next-js-image-optimization/blob/main/docs/assets/architecture.png?raw=true)
22+
1623
## Usage
1724

1825
### 1. Deploy the module to AWS
@@ -123,7 +130,7 @@ module.exports = {
123130
| next\_image\_device\_sizes | Allowed device sizes that should be used for image optimization. | `list(number)` | `null` | no |
124131
| next\_image\_domains | Allowed origin domains that can be used for fetching images. | `list(string)` | `[]` | no |
125132
| next\_image\_image\_sizes | Allowed image sizes that should be used for image optimization. | `list(number)` | `null` | no |
126-
| next\_image\_version | Next.js version from where you want to use the image optimizer from. Supports semver ranges. | `string` | `"^10.0.5-beta"` | no |
133+
| next\_image\_version | Next.js version from where you want to use the image optimizer from. Supports semver ranges. | `string` | `"10.0.5"` | no |
127134
| source\_bucket\_id | When your static files are deployed to a Bucket (e.g. with Terraform Next.js) the optimizer can pull the source from the bucket rather than over the internet. | `string` | `null` | no |
128135
| tags | Tag metadata to label AWS resources that support tags. | `map(string)` | `{}` | no |
129136

@@ -143,23 +150,14 @@ module.exports = {
143150

144151
## Versioning
145152

146-
We rely on the original Next.js image optimizer, so every version of the internal Lambda component [`@dealmore/tf-next-image-optimization`](https://www.npmjs.com/package/@dealmore/tf-next-image-optimization) follows the versioning schema of the official [Next.js package](https://www.npmjs.com/package/next).
147-
148-
By default we use the current major version `^10.0.5` of Next.js as base, so each deployment of the Terraform module pulls the latest package from this range.
149-
150-
However if you have problems with a specific version Next.js you can override this setting with a fixed version number or semver range:
153+
We rely internally on the original Next.js image optimizer.
154+
So the versioning of the module is aligned with the version of the corresponding Next.js release.
151155

152-
```diff
153-
# main.tf
154-
module "next_image_optimizer" {
155-
source = "dealmore/next-js-image-optimization/aws"
156+
For example the [`v10.0.5`](https://github.com/dealmore/terraform-aws-next-js-image-optimization/releases/tag/v10.0.5) version of this Terraform module uses the image optimizer from the [Next.js 10.0.5 release](https://github.com/vercel/next.js/releases/tag/v10.0.5).
156157

157-
next_image_domains = ["example.com", "sub.example.com"]
158-
+ next_image_version = "10.0.5"
159-
}
160-
```
158+
Due to compatibility issues we are not able to provide a matching version for every Next.js release.
161159

162-
Please note that we only publish versions `>=10.0.5`, for a full list of available versions see this [npm page](https://www.npmjs.com/package/@dealmore/tf-next-image-optimization?activeTab=versions).
160+
Please note that we only publish versions `>=10.0.5`, for a full list of available versions see the published versions in the [Terraform Registry](https://registry.terraform.io/modules/dealmore/next-js-image-optimization/aws).
163161

164162
## Contributing
165163

docs/assets/architecture.png

83.1 KB
Loading

lib/README.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

lib/declarations.d.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

lib/handler.ts

Lines changed: 0 additions & 132 deletions
This file was deleted.

lib/image-optimizer.ts

Lines changed: 0 additions & 112 deletions
This file was deleted.

0 commit comments

Comments
 (0)