Skip to content

Commit

Permalink
Merge commit 'ff5720bf6eb2434aa28c38d1bea514e2a73effe9' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 23, 2022
2 parents e57c42d + ff5720b commit a2e1536
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 16 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## [Unreleased]

## [0.11.2] - 2022-01-23

### Added

- Support for response headers policy (`cloudfront_response_headers_policy`) for the internal CloudFront distribution ([#265](https://github.com/milliHQ/terraform-aws-next-js/pull/265), [#268](https://github.com/milliHQ/terraform-aws-next-js/pull/268))
This also increases the minimum required [Terraform AWS provider](https://github.com/hashicorp/terraform-provider-aws) version from `3.43.0` to `3.64.0`.

### Fixed

- Bash script for uploading assets to S3 now uses the standard endpoint and is now compatible with newer AWS regions ([#263](https://github.com/milliHQ/terraform-aws-next-js/pull/263))
- Components fetched from npm registry now use relative paths that are stored in the Terraform state, which prevents unnecessary deployments ([#261](https://github.com/milliHQ/terraform-aws-next-js/pull/261))

## [0.11.1] - 2022-01-15

### Fixed
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ You can create a `.terraformignore` in the root of your project and add the foll
| Name | Version |
|------|---------|
| terraform | >= 0.15 |
| aws | >= 3.43.0 |
| aws | >= 3.64.0 |

## Providers

| Name | Version |
|------|---------|
| aws | >= 3.43.0 |
| aws | >= 3.64.0 |

## Inputs

Expand All @@ -220,6 +220,7 @@ You can create a `.terraformignore` in the root of your project and add the foll
| 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 or TLSv1.2\_2019. | `string` | `"TLSv1"` | no |
| cloudfront\_origin\_request\_policy | Id of a custom request policy that overrides the default policy (AllViewer). Can be custom or managed. | `string` | `null` | no |
| cloudfront\_price\_class | Price class for the CloudFront distributions (main & proxy config). One of PriceClass\_All, PriceClass\_200, PriceClass\_100. | `string` | `"PriceClass_100"` | no |
| cloudfront\_response\_headers\_policy | Id of a response headers policy. Can be custom or managed. Default is empty. | `string` | `null` | no |
| cloudfront\_webacl\_id | An optional webacl2 arn or webacl id to associate with the cloudfront distribution | `string` | `null` | no |
| create\_image\_optimization | Controls whether resources for image optimization support should be created or not. | `bool` | `true` | no |
| debug\_use\_local\_packages | Use locally built packages rather than download them from npm. | `bool` | `false` | no |
Expand Down
1 change: 0 additions & 1 deletion examples/with-custom-domain/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Terraform Next.js custom domain example

This example shows how to use a custom domain with the [Next.js Terraform module for AWS](https://registry.terraform.io/modules/milliHQ/next-js/aws).
The code is based on the [with existing CloudFront distribution example](https://github.com/milliHQ/terraform-aws-next-js/tree/main/examples/with-existing-cloudfront).

## Features

Expand Down
5 changes: 3 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,9 @@ locals {
compress = true
viewer_protocol_policy = "redirect-to-https"

origin_request_policy_id = var.cloudfront_origin_request_policy != null ? var.cloudfront_origin_request_policy : data.aws_cloudfront_origin_request_policy.managed_all_viewer.id
cache_policy_id = aws_cloudfront_cache_policy.this.id
origin_request_policy_id = var.cloudfront_origin_request_policy != null ? var.cloudfront_origin_request_policy : data.aws_cloudfront_origin_request_policy.managed_all_viewer.id
response_headers_policy_id = var.cloudfront_response_headers_policy
cache_policy_id = aws_cloudfront_cache_policy.this.id

lambda_function_association = {
event_type = "origin-request"
Expand Down
5 changes: 3 additions & 2 deletions modules/cloudfront-main/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ resource "aws_cloudfront_distribution" "distribution" {
viewer_protocol_policy = default_cache_behavior.value["viewer_protocol_policy"]
compress = default_cache_behavior.value["compress"]

origin_request_policy_id = default_cache_behavior.value["origin_request_policy_id"]
cache_policy_id = default_cache_behavior.value["cache_policy_id"]
origin_request_policy_id = default_cache_behavior.value["origin_request_policy_id"]
response_headers_policy_id = default_cache_behavior.value["response_headers_policy_id"]
cache_policy_id = default_cache_behavior.value["cache_policy_id"]

dynamic "lambda_function_association" {
for_each = [default_cache_behavior.value["lambda_function_association"]]
Expand Down
2 changes: 1 addition & 1 deletion modules/cloudfront-main/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.0"
version = ">= 3.64.0"
}
}
}
4 changes: 2 additions & 2 deletions modules/proxy/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "proxy_package" {
source = "milliHQ/download/npm"
version = "2.0.0"
version = "2.1.0"

module_name = "@millihq/terraform-next-proxy"
module_version = var.proxy_module_version
Expand All @@ -26,7 +26,7 @@ module "edge_proxy" {
role_permissions_boundary = var.lambda_role_permissions_boundary

create_package = false
local_existing_package = module.proxy_package.abs_path
local_existing_package = module.proxy_package.rel_path

cloudwatch_logs_retention_in_days = 30

Expand Down
2 changes: 1 addition & 1 deletion modules/proxy/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

variable "proxy_module_version" {
type = string
default = "0.11.1"
default = "0.11.2"
}

variable "lambda_default_runtime" {
Expand Down
4 changes: 2 additions & 2 deletions modules/statics-deploy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ data "aws_iam_policy_document" "access_sqs_queue" {

module "lambda_content" {
source = "milliHQ/download/npm"
version = "2.0.0"
version = "2.1.0"

module_name = "@millihq/terraform-next-deploy-trigger"
module_version = var.deploy_trigger_module_version
Expand All @@ -185,7 +185,7 @@ module "deploy_trigger" {
role_permissions_boundary = var.lambda_role_permissions_boundary

create_package = false
local_existing_package = module.lambda_content.abs_path
local_existing_package = module.lambda_content.rel_path

# Prevent running concurrently
reserved_concurrent_executions = 1
Expand Down
2 changes: 1 addition & 1 deletion modules/statics-deploy/s3-bash4/lib/s3-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ convS3RegionToEndpoint() {
case "$1" in
us-east-1) echo "s3.amazonaws.com"
;;
*) echo s3-${1}.amazonaws.com
*) echo s3.${1}.amazonaws.com
;;
esac
}
Expand Down
2 changes: 1 addition & 1 deletion modules/statics-deploy/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ variable "static_files_archive" {

variable "deploy_trigger_module_version" {
type = string
default = "0.11.1"
default = "0.11.2"
}

variable "expire_static_assets" {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ variable "cloudfront_origin_request_policy" {
default = null
}

variable "cloudfront_response_headers_policy" {
description = "Id of a response headers policy. Can be custom or managed. Default is empty."
type = string
default = null
}

variable "cloudfront_cache_key_headers" {
description = "Header keys that should be used to calculate the cache key in CloudFront."
type = list(string)
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.43.0"
version = ">= 3.64.0"
configuration_aliases = [aws.global_region]
}
}
Expand Down

0 comments on commit a2e1536

Please sign in to comment.