Skip to content

Commit 09398da

Browse files
authored
feat: Added support for connection_attempts, connection_timeout, and origin_shield (#47)
1 parent fe694c7 commit 09398da

File tree

6 files changed

+34
-15
lines changed

6 files changed

+34
-15
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ module "cdn" {
8686

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

9292
## Providers
9393

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

9898
## Modules
9999

examples/complete/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ 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.0 |
30-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.28.0 |
29+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
30+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.28 |
3131
| <a name="requirement_null"></a> [null](#requirement\_null) | ~> 2 |
3232
| <a name="requirement_random"></a> [random](#requirement\_random) | ~> 2 |
3333

3434
## Providers
3535

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

@@ -47,7 +47,7 @@ Note that this example may create resources which cost money. Run `terraform des
4747
| <a name="module_cloudfront"></a> [cloudfront](#module\_cloudfront) | ../../ | |
4848
| <a name="module_lambda_function"></a> [lambda\_function](#module\_lambda\_function) | terraform-aws-modules/lambda/aws | ~> 2.0 |
4949
| <a name="module_log_bucket"></a> [log\_bucket](#module\_log\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 2.0 |
50-
| <a name="module_records"></a> [records](#module\_records) | terraform-aws-modules/route53/aws//modules/records | ~> 2.0 |
50+
| <a name="module_records"></a> [records](#module\_records) | terraform-aws-modules/route53/aws//modules/records | 2.0.0 |
5151
| <a name="module_s3_one"></a> [s3\_one](#module\_s3\_one) | terraform-aws-modules/s3-bucket/aws | ~> 2.0 |
5252

5353
## Resources

examples/complete/main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ module "cloudfront" {
5858
value = "SAMEORIGIN"
5959
}
6060
]
61+
62+
origin_shield = {
63+
enabled = true
64+
origin_shield_region = "us-east-1"
65+
}
6166
}
6267

6368
s3_one = {
@@ -237,7 +242,7 @@ module "lambda_function" {
237242

238243
module "records" {
239244
source = "terraform-aws-modules/route53/aws//modules/records"
240-
version = "~> 2.0"
245+
version = "2.0.0" # @todo: revert to "~> 2.0" once 2.1.0 is fixed properly
241246

242247
zone_id = data.aws_route53_zone.this.zone_id
243248

examples/complete/versions.tf

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

44
required_providers {
5-
aws = ">= 3.28.0"
5+
aws = ">= 3.28"
66
random = "~> 2"
77
null = "~> 2"
88
}

main.tf

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,23 @@ resource "aws_cloudfront_distribution" "this" {
3737
for_each = var.origin
3838

3939
content {
40-
domain_name = origin.value.domain_name
41-
origin_id = lookup(origin.value, "origin_id", origin.key)
42-
origin_path = lookup(origin.value, "origin_path", "")
40+
domain_name = origin.value.domain_name
41+
origin_id = lookup(origin.value, "origin_id", origin.key)
42+
origin_path = lookup(origin.value, "origin_path", "")
43+
connection_attempts = lookup(origin.value, "connection_attempts", null)
44+
connection_timeout = lookup(origin.value, "connection_timeout", null)
4345

4446
dynamic "s3_origin_config" {
4547
for_each = length(keys(lookup(origin.value, "s3_origin_config", {}))) == 0 ? [] : [lookup(origin.value, "s3_origin_config", {})]
48+
4649
content {
4750
origin_access_identity = lookup(s3_origin_config.value, "cloudfront_access_identity_path", lookup(lookup(aws_cloudfront_origin_access_identity.this, lookup(s3_origin_config.value, "origin_access_identity", ""), {}), "cloudfront_access_identity_path", null))
4851
}
4952
}
5053

5154
dynamic "custom_origin_config" {
5255
for_each = length(lookup(origin.value, "custom_origin_config", "")) == 0 ? [] : [lookup(origin.value, "custom_origin_config", "")]
56+
5357
content {
5458
http_port = custom_origin_config.value.http_port
5559
https_port = custom_origin_config.value.https_port
@@ -62,11 +66,21 @@ resource "aws_cloudfront_distribution" "this" {
6266

6367
dynamic "custom_header" {
6468
for_each = lookup(origin.value, "custom_header", [])
69+
6570
content {
6671
name = custom_header.value.name
6772
value = custom_header.value.value
6873
}
6974
}
75+
76+
dynamic "origin_shield" {
77+
for_each = length(keys(lookup(origin.value, "origin_shield", {}))) == 0 ? [] : [lookup(origin.value, "origin_shield", {})]
78+
79+
content {
80+
enabled = origin_shield.value.enabled
81+
origin_shield_region = origin_shield.value.origin_shield_region
82+
}
83+
}
7084
}
7185
}
7286

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.0"
2+
required_version = ">= 0.13"
33

44
required_providers {
5-
aws = ">= 3.41.0"
5+
aws = ">= 3.43"
66
}
77
}

0 commit comments

Comments
 (0)