diff --git a/.github/workflows/tf-docs.yml b/.github/workflows/tf-docs.yml index 2bac40b..5e2f6a8 100644 --- a/.github/workflows/tf-docs.yml +++ b/.github/workflows/tf-docs.yml @@ -12,9 +12,9 @@ jobs: update-docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Update Terraform docs in README - uses: terraform-docs/gh-actions@v0.10.0 + uses: terraform-docs/gh-actions@v1.0.0 with: config-file: '.terraform-docs.yml' output-file: README.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 461ca82..174f841 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## [Unreleased] +## [12.1.3] - 2022-08-12 + +- Uses Image Optimizer module of [Next.js 12.1.3](https://github.com/vercel/next.js/releases/tag/v12.1.3) ([#121](https://github.com/milliHQ/terraform-aws-next-js-image-optimization/pull/121)) +- Updates sharp from `v0.30.3` to [`v0.30.7`](https://github.com/lovell/sharp/releases/tag/v0.30.7) ([#136](https://github.com/milliHQ/terraform-aws-next-js-image-optimization/pull/136)) +- Support usage of custom domain and SSL certificate with the default CloudFront distribution ([#134](https://github.com/milliHQ/terraform-aws-next-js-image-optimization/pull/134)) +- Minimum protocol version for the default CloudFront distribution can now set using `cloudfront_minimum_protocol_version` variable. New default value is `TLSv1` (was `TLSv1.2_2018` before) ([#134](https://github.com/milliHQ/terraform-aws-next-js-image-optimization/pull/134)) + ## [12.1.2] - 2022-04-16 - Uses Image Optimizer module of [Next.js 12.1.2](https://github.com/vercel/next.js/releases/tag/v12.1.2) ([#118](https://github.com/milliHQ/terraform-aws-next-js-image-optimization/pull/118)) diff --git a/README.md b/README.md index 0b12dda..ca681d0 100644 --- a/README.md +++ b/README.md @@ -104,8 +104,8 @@ Then rebuild and redeploy your Next.js application to make use of the changed co Use the image optimizer with an existing CloudFront distribution. - - + + ## Requirements | Name | Version | @@ -123,10 +123,13 @@ Then rebuild and redeploy your Next.js application to make use of the changed co | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| cloudfront\_acm\_certificate\_arn | CloudFront ACM certificate to use. | `string` | `null` | no | +| cloudfront\_aliases | Custom domain(s) for CloudFront. | `list(string)` | `[]` | no | | cloudfront\_create\_distribution | Controls whether a CloudFront distribution should be created. | `bool` | `true` | no | | cloudfront\_enable\_origin\_shield | Controls whether CloudFront Origin Shield should be enabled on the image optimizer lambdas. | `bool` | `true` | no | +| cloudfront\_minimum\_protocol\_version | The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections. One of SSLv3, TLSv1, TLSv1\_2016, TLSv1.1\_2016, TLSv1.2\_2018 TLSv1.2\_2019 or TLSv1.2\_2021. | `string` | `"TLSv1"` | no | | cloudfront\_origin\_id | Override the id for the custom CloudFront id. | `string` | `"tf-next-image-optimizer"` | no | -| cloudfront\_origin\_shield\_region | Override the region choosen for the CloudFront origin shield. Use `auto` to automatically determine the optimal region. | `string` | `"auto"` | no | +| cloudfront\_origin\_shield\_region | Override the region chosen for the CloudFront origin shield. Use `auto` to automatically determine the optimal region. | `string` | `"auto"` | no | | cloudfront\_price\_class | Price class for the CloudFront distribution. One of PriceClass\_All, PriceClass\_200, PriceClass\_100. | `string` | `"PriceClass_100"` | no | | debug\_use\_local\_packages | (Debug) Use local packages instead of downloading them from npm. | `bool` | `false` | no | | deployment\_name | Identifier for the deployment group (only lowercase alphanumeric characters and hyphens are allowed). | `string` | `"tf-next-image"` | no | @@ -142,7 +145,7 @@ Then rebuild and redeploy your Next.js application to make use of the changed co | next\_image\_domains | Allowed origin domains that can be used for fetching images. | `list(string)` | `[]` | no | | next\_image\_formats | If the Accept head matches more than one of the configured formats, the first match in the array is used. Therefore, the array order matters. If there is no match, the Image Optimization API will fallback to the original image's format. | `list(string)` |
[| no | | next\_image\_image\_sizes | Allowed image sizes that should be used for image optimization. | `list(number)` | `null` | no | -| next\_image\_version | Next.js version from where you want to use the image optimizer from. Supports semver ranges. | `string` | `"12.1.2"` | no | +| next\_image\_version | Next.js version from where you want to use the image optimizer from. Supports semver ranges. | `string` | `"12.1.3"` | no | | 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 | | tags | Tag metadata to label AWS resources that support tags. | `map(string)` | `{}` | no | @@ -157,8 +160,7 @@ Then rebuild and redeploy your Next.js application to make use of the changed co | cloudfront\_origin | Predefined CloudFront origin. Can be used to embed the image optimizer into an existing CloudFront resource. | | cloudfront\_origin\_id | Id of the custom origin used for image optimization. | | cloudfront\_origin\_request\_policy\_id | Request policy id used for image optimization. | - - + ## Limits diff --git a/examples/with-custom-domain/README.md b/examples/with-custom-domain/README.md new file mode 100644 index 0000000..90d8134 --- /dev/null +++ b/examples/with-custom-domain/README.md @@ -0,0 +1,66 @@ +# Custom Domain Example + +This example shows how to configure a custom domain for the [Terraform Next.js Image Optimization module for AWS](https://github.com/milliHQ/terraform-aws-next-js-image-optimization). + +> **Note:** The full example code is available on [GitHub](https://github.com/milliHQ/terraform-aws-next-js-image-optimization/tree/main/examples/with-custom-domain) + +## Setup the Terraform module + +1. Create a new file called `main.tf` and paste the code from the following source: [main.tf on GitHub](https://github.com/milliHQ/terraform-aws-next-js-image-optimization/blob/main/examples/with-custom-domain/main.tf): + +2. Then configure the domain you want to use: + + ```tf + # main.tf + + ... + ########### + # Variables + ########### + + variable "custom_domain" { + description = "Your custom domain" + type = string + default = "example.com" + } + + variable "custom_domain_zone_name" { + description = "The Route53 zone name of the custom domain" + type = string + default = "example.com." + } + + ... + ``` + +3. Run Terraform to deploy the image optimizer to your AWS account: + + ```sh + terraform init # Only needed on the first time running Terraform + + terraform plan # (Optional) See what resources Terraform will create + terraform apply # Deploy the image optimizer module to your AWS account + ``` + + After Terraform has successfully created all resources in your AWS account, you should see the following output on the terminal: + + ```sh + > Apply complete! + > + > Outputs: + > + > custom_domain = "example.com" + > cloudfront_domain = "
"image/webp"
]