Skip to content

Commit b1f90d3

Browse files
feat: Added support for response headers policy (#57)
1 parent f17690d commit b1f90d3

File tree

9 files changed

+37
-32
lines changed

9 files changed

+37
-32
lines changed

.chglog/CHANGELOG.tpl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@
4848
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
4949
{{ end -}}
5050
{{ end -}}
51-
{{ end -}}
51+
{{ end -}}

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ tab_width = 2
2727
indent_style = tab
2828

2929
[COMMIT_EDITMSG]
30-
max_line_length = 0
30+
max_line_length = 0

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
2-
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.50.0
2+
- repo: https://github.com/antonbabenko/pre-commit-terraform
3+
rev: v1.55.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate
@@ -20,7 +20,8 @@ repos:
2020
- '--args=--only=terraform_required_providers'
2121
- '--args=--only=terraform_standard_module_structure'
2222
- '--args=--only=terraform_workspace_remote'
23-
- repo: git://github.com/pre-commit/pre-commit-hooks
24-
rev: v3.4.0
23+
- repo: https://github.com/pre-commit/pre-commit-hooks
24+
rev: v4.0.1
2525
hooks:
2626
- id: check-merge-conflict
27+
- id: end-of-file-fixer

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ module "cdn" {
4848
}
4949
5050
default_cache_behavior = {
51-
target_origin_id = "something"
52-
viewer_protocol_policy = "allow-all"
51+
target_origin_id = "something"
52+
viewer_protocol_policy = "allow-all"
5353
5454
allowed_methods = ["GET", "HEAD", "OPTIONS"]
5555
cached_methods = ["GET", "HEAD"]
@@ -86,14 +86,14 @@ module "cdn" {
8686

8787
| Name | Version |
8888
|------|---------|
89-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
90-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.43 |
89+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
90+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.64 |
9191

9292
## Providers
9393

9494
| Name | Version |
9595
|------|---------|
96-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.43 |
96+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.64 |
9797

9898
## Modules
9999

examples/complete/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ Note that this example may create resources which cost money. Run `terraform des
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
29+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
3030
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.28 |
31-
| <a name="requirement_null"></a> [null](#requirement\_null) | ~> 2 |
32-
| <a name="requirement_random"></a> [random](#requirement\_random) | ~> 2 |
31+
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2 |
32+
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2 |
3333

3434
## Providers
3535

3636
| Name | Version |
3737
|------|---------|
3838
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.28 |
39-
| <a name="provider_null"></a> [null](#provider\_null) | ~> 2 |
40-
| <a name="provider_random"></a> [random](#provider\_random) | ~> 2 |
39+
| <a name="provider_null"></a> [null](#provider\_null) | >= 2 |
40+
| <a name="provider_random"></a> [random](#provider\_random) | >= 2 |
4141

4242
## Modules
4343

examples/complete/main.tf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module "cloudfront" {
2929
wait_for_deployment = false
3030

3131
# When you enable additional metrics for a distribution, CloudFront sends up to 8 metrics to CloudWatch in the US East (N. Virginia) Region.
32-
# This rate is charged only once per month, per metric (up to 8 metrics per distribution).
32+
# This rate is charged only once per month, per metric (up to 8 metrics per distribution).
3333
create_monitoring_subscription = true
3434

3535
create_origin_access_identity = true
@@ -89,11 +89,13 @@ module "cloudfront" {
8989
default_cache_behavior = {
9090
target_origin_id = "appsync"
9191
viewer_protocol_policy = "allow-all"
92+
allowed_methods = ["GET", "HEAD", "OPTIONS"]
93+
cached_methods = ["GET", "HEAD"]
94+
compress = true
95+
query_string = true
9296

93-
allowed_methods = ["GET", "HEAD", "OPTIONS"]
94-
cached_methods = ["GET", "HEAD"]
95-
compress = true
96-
query_string = true
97+
# This is id for SecurityHeadersPolicy copied from https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-response-headers-policies.html
98+
response_headers_policy_id = "67f7725c-6f97-4210-82d7-5512b31e9d03"
9799

98100
lambda_function_association = {
99101

examples/complete/versions.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
terraform {
2-
required_version = ">= 0.13"
2+
required_version = ">= 0.13.1"
33

44
required_providers {
55
aws = ">= 3.28"
6-
random = "~> 2"
7-
null = "~> 2"
6+
random = ">= 2"
7+
null = ">= 2"
88
}
99
}

main.tf

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ resource "aws_cloudfront_distribution" "this" {
120120
trusted_signers = lookup(i.value, "trusted_signers", null)
121121
trusted_key_groups = lookup(i.value, "trusted_key_groups", null)
122122

123-
cache_policy_id = lookup(i.value, "cache_policy_id", null)
124-
origin_request_policy_id = lookup(i.value, "origin_request_policy_id", null)
125-
realtime_log_config_arn = lookup(i.value, "realtime_log_config_arn", null)
123+
cache_policy_id = lookup(i.value, "cache_policy_id", null)
124+
origin_request_policy_id = lookup(i.value, "origin_request_policy_id", null)
125+
response_headers_policy_id = lookup(i.value, "response_headers_policy_id", null)
126+
realtime_log_config_arn = lookup(i.value, "realtime_log_config_arn", null)
126127

127128
min_ttl = lookup(i.value, "min_ttl", null)
128129
default_ttl = lookup(i.value, "default_ttl", null)
@@ -183,9 +184,10 @@ resource "aws_cloudfront_distribution" "this" {
183184
trusted_signers = lookup(i.value, "trusted_signers", null)
184185
trusted_key_groups = lookup(i.value, "trusted_key_groups", null)
185186

186-
cache_policy_id = lookup(i.value, "cache_policy_id", null)
187-
origin_request_policy_id = lookup(i.value, "origin_request_policy_id", null)
188-
realtime_log_config_arn = lookup(i.value, "realtime_log_config_arn", null)
187+
cache_policy_id = lookup(i.value, "cache_policy_id", null)
188+
origin_request_policy_id = lookup(i.value, "origin_request_policy_id", null)
189+
response_headers_policy_id = lookup(i.value, "response_headers_policy_id", null)
190+
realtime_log_config_arn = lookup(i.value, "realtime_log_config_arn", null)
189191

190192
min_ttl = lookup(i.value, "min_ttl", null)
191193
default_ttl = lookup(i.value, "default_ttl", null)

versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
2-
required_version = ">= 0.13"
2+
required_version = ">= 0.13.1"
33

44
required_providers {
5-
aws = ">= 3.48"
5+
aws = ">= 3.64"
66
}
77
}

0 commit comments

Comments
 (0)