You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: Enable explicit origin type definiton
The module is meant to be used with custom origins, but it may happen
that your origin of choice is an S3 bucket that's not managed by
yourself. `cloudposse/cloudfront-s3-cdn/aws` may seem to be a viable
alternative (it supports pre-existing buckets), but there's an implicit
assumption there - both the origin bucket and the CloudFront
distribution that points to it should be deployed to the same AWS
account. In order to secure CDN-to-S3 communication one may want to
specify either OAI or OAC. Prior to this change, it was not possible to
use OAI when S3 bucket domain name was used.
* fix: Set OAC only when S3 type origin was used
When user specifies an S3 domain name as the origin and attaches OAC to
it, Terraform fails with the following error:
Illegal configuration: The origin type and OAC origin type differ.
* feat: Make sure origin shield can be specified for non-default origins
At the moment origin shield can be configured only for the default
origin. This commit enables the feature for all the remaining ones.
* fix: Replace unsupported map() references
`map()` function is no longer available
* fix: Zero all TTL params when cache policy ID is configured
When cache policy ID is specified, all TTL arguments should be zeroed,
as the policy-scoped TTLs take precedence. If non-zero `min_ttl`,
`default_ttl` or `max_ttl` is set to non-0 value and at the same time
cache policy is specified it leads to phantom changes in the plan:
default_ttl = 0 -> 60
* Revert "fix: Zero all TTL params when cache policy ID is configured"
This reverts commit 30ff7b9.
This should be moved to a separate PR to narrow down the scope just to
origin-related changes
* docs: Reflect new/updated variables in the README file
* fix: Fallback to default OAI when S3 origin was specified without `s3_origin_config` variable
* feat: Add S3-specific examples
* chore: Add an explicit comment to OAI resource
* chore: Update OAI name
* chore: Update s3_origin_config variable description
* feat: Init s3_origin_config block only when OAC wasn't provided
* fix: Improve S3 examples
* chore: Resource naming convention
---------
Co-authored-by: Dan Miller <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -151,7 +151,7 @@ Available targets:
151
151
| <aname="input_context"></a> [context](#input\_context)| Single object for setting entire context at once.<br/>See description of individual variables for details.<br/>Leave string and numeric variables as `null` to use default value.<br/>Individual variable settings (non-null) override settings in context object,<br/>except for attributes, tags, and additional\_tag\_map, which are merged. |`any`| <pre>{<br/> "additional_tag_map": {},<br/> "attributes": [],<br/> "delimiter": null,<br/> "descriptor_formats": {},<br/> "enabled": true,<br/> "environment": null,<br/> "id_length_limit": null,<br/> "label_key_case": null,<br/> "label_order": [],<br/> "label_value_case": null,<br/> "labels_as_tags": [<br/> "unset"<br/> ],<br/> "name": null,<br/> "namespace": null,<br/> "regex_replace_chars": null,<br/> "stage": null,<br/> "tags": {},<br/> "tenant": null<br/>}</pre> | no |
152
152
| <aname="input_custom_error_response"></a> [custom\_error\_response](#input\_custom\_error\_response)| List of one or more custom error response element maps | <pre>list(object({<br/> error_caching_min_ttl = string<br/> error_code = string<br/> response_code = string<br/> response_page_path = string<br/> }))</pre> |`[]`| no |
153
153
| <aname="input_custom_header"></a> [custom\_header](#input\_custom\_header)| List of one or more custom headers passed to the origin | <pre>list(object({<br/> name = string<br/> value = string<br/> }))</pre> |`[]`| no |
154
-
| <a name="input_custom_origins"></a> [custom\_origins](#input\_custom\_origins) | One or more custom origins for this distribution (multiples allowed). See documentation for configuration options description https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html#origin-arguments | <pre>list(object({<br/> domain_name = string<br/> origin_id = string<br/> origin_path = string<br/> origin_access_control_id = string<br/> custom_headers = list(object({<br/> name = string<br/> value = string<br/> }))<br/> custom_origin_config = object({<br/> http_port = number<br/> https_port = number<br/> origin_protocol_policy = string<br/> origin_ssl_protocols = list(string)<br/> origin_keepalive_timeout = number<br/> origin_read_timeout = number<br/> })<br/> s3_origin_config = object({<br/> origin_access_identity = string<br/> })<br/> }))</pre> | `[]` | no |
154
+
| <a name="input_custom_origins"></a> [custom\_origins](#input\_custom\_origins) | One or more custom origins for this distribution (multiples allowed). See documentation for configuration options description https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html#origin-arguments | <pre>list(object({<br/> domain_name = string<br/> origin_id = string<br/> origin_path = string<br/> origin_access_control_id = string<br/> custom_headers = list(object({<br/> name = string<br/> value = string<br/> }))<br/> custom_origin_config = object({<br/> http_port = number<br/> https_port = number<br/> origin_protocol_policy = string<br/> origin_ssl_protocols = list(string)<br/> origin_keepalive_timeout = number<br/> origin_read_timeout = number<br/> })<br/> s3_origin_config = object({<br/> origin_access_identity = string<br/> })<br/> origin_shield = object({<br/> enabled = bool<br/> region = string<br/> })<br/> }))</pre> | `[]` | no |
155
155
| <aname="input_default_root_object"></a> [default\_root\_object](#input\_default\_root\_object)| Object that CloudFront return when requests the root URL |`string`|`"index.html"`| no |
156
156
| <aname="input_default_ttl"></a> [default\_ttl](#input\_default\_ttl)| Default amount of time (in seconds) that an object is in a CloudFront cache |`number`|`60`| no |
157
157
| <aname="input_delimiter"></a> [delimiter](#input\_delimiter)| Delimiter to be used between ID elements.<br/>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. |`string`|`null`| no |
@@ -201,12 +201,14 @@ Available targets:
201
201
| <aname="input_origin_request_policy_id"></a> [origin\_request\_policy\_id](#input\_origin\_request\_policy\_id)| ID of the origin request policy attached to the cache behavior |`string`|`null`| no |
202
202
| <aname="input_origin_shield"></a> [origin\_shield](#input\_origin\_shield)| The CloudFront Origin Shield settings | <pre>object({<br/> enabled = bool<br/> region = string<br/> })</pre> |`null`| no |
203
203
| <aname="input_origin_ssl_protocols"></a> [origin\_ssl\_protocols](#input\_origin\_ssl\_protocols)| The SSL/TLS protocols that you want CloudFront to use when communicating with your origin over HTTPS |`list(string)`| <pre>[<br/> "TLSv1",<br/> "TLSv1.1",<br/> "TLSv1.2"<br/>]</pre> | no |
204
+
| <aname="input_origin_type"></a> [origin\_type](#input\_origin\_type)| The type of origin configuration to use. Valid values are 'custom' or 's3'. |`string`|`"custom"`| no |
204
205
| <aname="input_parent_zone_id"></a> [parent\_zone\_id](#input\_parent\_zone\_id)| ID of the hosted zone to contain this record (or specify `parent_zone_name`) |`string`|`""`| no |
205
206
| <aname="input_parent_zone_name"></a> [parent\_zone\_name](#input\_parent\_zone\_name)| Name of the hosted zone to contain this record (or specify `parent_zone_id`) |`string`|`""`| no |
206
207
| <aname="input_price_class"></a> [price\_class](#input\_price\_class)| Price class for this distribution: `PriceClass_All`, `PriceClass_200`, `PriceClass_100`|`string`|`"PriceClass_100"`| no |
207
208
| <aname="input_realtime_log_config_arn"></a> [realtime\_log\_config\_arn](#input\_realtime\_log\_config\_arn)| The ARN of the real-time log configuration that is attached to this cache behavior |`string`|`null`| no |
208
209
| <aname="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars)| Terraform regular expression (regex) string.<br/>Characters matching the regex will be removed from the ID elements.<br/>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. |`string`|`null`| no |
209
210
| <aname="input_response_headers_policy_id"></a> [response\_headers\_policy\_id](#input\_response\_headers\_policy\_id)| The identifier for a response headers policy |`string`|`""`| no |
211
+
| <aname="input_s3_origin_config"></a> [s3\_origin\_config](#input\_s3\_origin\_config)| Optional configuration for an S3 origin. | <pre>object({<br/> origin_access_identity = string<br/> })</pre> |`null`| no |
210
212
| <aname="input_stage"></a> [stage](#input\_stage)| ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' |`string`|`null`| no |
211
213
| <aname="input_tags"></a> [tags](#input\_tags)| Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br/>Neither the tag keys nor the tag values will be modified by this module. |`map(string)`|`{}`| no |
212
214
| <aname="input_tenant"></a> [tenant](#input\_tenant)| ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for |`string`|`null`| no |
Copy file name to clipboardExpand all lines: docs/terraform.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@
45
45
| <aname="input_context"></a> [context](#input\_context)| Single object for setting entire context at once.<br/>See description of individual variables for details.<br/>Leave string and numeric variables as `null` to use default value.<br/>Individual variable settings (non-null) override settings in context object,<br/>except for attributes, tags, and additional\_tag\_map, which are merged. |`any`| <pre>{<br/> "additional_tag_map": {},<br/> "attributes": [],<br/> "delimiter": null,<br/> "descriptor_formats": {},<br/> "enabled": true,<br/> "environment": null,<br/> "id_length_limit": null,<br/> "label_key_case": null,<br/> "label_order": [],<br/> "label_value_case": null,<br/> "labels_as_tags": [<br/> "unset"<br/> ],<br/> "name": null,<br/> "namespace": null,<br/> "regex_replace_chars": null,<br/> "stage": null,<br/> "tags": {},<br/> "tenant": null<br/>}</pre> | no |
46
46
| <aname="input_custom_error_response"></a> [custom\_error\_response](#input\_custom\_error\_response)| List of one or more custom error response element maps | <pre>list(object({<br/> error_caching_min_ttl = string<br/> error_code = string<br/> response_code = string<br/> response_page_path = string<br/> }))</pre> |`[]`| no |
47
47
| <aname="input_custom_header"></a> [custom\_header](#input\_custom\_header)| List of one or more custom headers passed to the origin | <pre>list(object({<br/> name = string<br/> value = string<br/> }))</pre> |`[]`| no |
48
-
| <a name="input_custom_origins"></a> [custom\_origins](#input\_custom\_origins) | One or more custom origins for this distribution (multiples allowed). See documentation for configuration options description https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html#origin-arguments | <pre>list(object({<br/> domain_name = string<br/> origin_id = string<br/> origin_path = string<br/> origin_access_control_id = string<br/> custom_headers = list(object({<br/> name = string<br/> value = string<br/> }))<br/> custom_origin_config = object({<br/> http_port = number<br/> https_port = number<br/> origin_protocol_policy = string<br/> origin_ssl_protocols = list(string)<br/> origin_keepalive_timeout = number<br/> origin_read_timeout = number<br/> })<br/> s3_origin_config = object({<br/> origin_access_identity = string<br/> })<br/> }))</pre> | `[]` | no |
48
+
| <a name="input_custom_origins"></a> [custom\_origins](#input\_custom\_origins) | One or more custom origins for this distribution (multiples allowed). See documentation for configuration options description https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html#origin-arguments | <pre>list(object({<br/> domain_name = string<br/> origin_id = string<br/> origin_path = string<br/> origin_access_control_id = string<br/> custom_headers = list(object({<br/> name = string<br/> value = string<br/> }))<br/> custom_origin_config = object({<br/> http_port = number<br/> https_port = number<br/> origin_protocol_policy = string<br/> origin_ssl_protocols = list(string)<br/> origin_keepalive_timeout = number<br/> origin_read_timeout = number<br/> })<br/> s3_origin_config = object({<br/> origin_access_identity = string<br/> })<br/> origin_shield = object({<br/> enabled = bool<br/> region = string<br/> })<br/> }))</pre> | `[]` | no |
49
49
| <aname="input_default_root_object"></a> [default\_root\_object](#input\_default\_root\_object)| Object that CloudFront return when requests the root URL |`string`|`"index.html"`| no |
50
50
| <aname="input_default_ttl"></a> [default\_ttl](#input\_default\_ttl)| Default amount of time (in seconds) that an object is in a CloudFront cache |`number`|`60`| no |
51
51
| <aname="input_delimiter"></a> [delimiter](#input\_delimiter)| Delimiter to be used between ID elements.<br/>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. |`string`|`null`| no |
@@ -95,12 +95,14 @@
95
95
| <aname="input_origin_request_policy_id"></a> [origin\_request\_policy\_id](#input\_origin\_request\_policy\_id)| ID of the origin request policy attached to the cache behavior |`string`|`null`| no |
96
96
| <aname="input_origin_shield"></a> [origin\_shield](#input\_origin\_shield)| The CloudFront Origin Shield settings | <pre>object({<br/> enabled = bool<br/> region = string<br/> })</pre> |`null`| no |
97
97
| <aname="input_origin_ssl_protocols"></a> [origin\_ssl\_protocols](#input\_origin\_ssl\_protocols)| The SSL/TLS protocols that you want CloudFront to use when communicating with your origin over HTTPS |`list(string)`| <pre>[<br/> "TLSv1",<br/> "TLSv1.1",<br/> "TLSv1.2"<br/>]</pre> | no |
98
+
| <aname="input_origin_type"></a> [origin\_type](#input\_origin\_type)| The type of origin configuration to use. Valid values are 'custom' or 's3'. |`string`|`"custom"`| no |
98
99
| <aname="input_parent_zone_id"></a> [parent\_zone\_id](#input\_parent\_zone\_id)| ID of the hosted zone to contain this record (or specify `parent_zone_name`) |`string`|`""`| no |
99
100
| <aname="input_parent_zone_name"></a> [parent\_zone\_name](#input\_parent\_zone\_name)| Name of the hosted zone to contain this record (or specify `parent_zone_id`) |`string`|`""`| no |
100
101
| <aname="input_price_class"></a> [price\_class](#input\_price\_class)| Price class for this distribution: `PriceClass_All`, `PriceClass_200`, `PriceClass_100`|`string`|`"PriceClass_100"`| no |
101
102
| <aname="input_realtime_log_config_arn"></a> [realtime\_log\_config\_arn](#input\_realtime\_log\_config\_arn)| The ARN of the real-time log configuration that is attached to this cache behavior |`string`|`null`| no |
102
103
| <aname="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars)| Terraform regular expression (regex) string.<br/>Characters matching the regex will be removed from the ID elements.<br/>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. |`string`|`null`| no |
103
104
| <aname="input_response_headers_policy_id"></a> [response\_headers\_policy\_id](#input\_response\_headers\_policy\_id)| The identifier for a response headers policy |`string`|`""`| no |
105
+
| <aname="input_s3_origin_config"></a> [s3\_origin\_config](#input\_s3\_origin\_config)| Optional configuration for an S3 origin. | <pre>object({<br/> origin_access_identity = string<br/> })</pre> |`null`| no |
104
106
| <aname="input_stage"></a> [stage](#input\_stage)| ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' |`string`|`null`| no |
105
107
| <aname="input_tags"></a> [tags](#input\_tags)| Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br/>Neither the tag keys nor the tag values will be modified by this module. |`map(string)`|`{}`| no |
106
108
| <aname="input_tenant"></a> [tenant](#input\_tenant)| ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for |`string`|`null`| no |
0 commit comments