@@ -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
0 commit comments