Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add external_aliases Which Will Not Have CNAMEs Created for Them #199

Merged
merged 12 commits into from Dec 14, 2021
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -447,6 +447,7 @@ Available targets:
| <a name="input_encryption_enabled"></a> [encryption\_enabled](#input\_encryption\_enabled) | When set to 'true' the resource will have aes256 encryption enabled by default | `bool` | `true` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| <a name="input_error_document"></a> [error\_document](#input\_error\_document) | An absolute path to the document to return in case of a 4XX error | `string` | `""` | no |
| <a name="input_external_aliases"></a> [external\_aliases](#input\_external\_aliases) | List of FQDN's - Used to set the Alternate Domain Names (CNAMEs) setting on Cloudfront. No new route53 records will be created for these | `list(string)` | `[]` | no |
| <a name="input_extra_logs_attributes"></a> [extra\_logs\_attributes](#input\_extra\_logs\_attributes) | Additional attributes to add to the end of the generated Cloudfront Access Log S3 Bucket name.<br>Only effective if `cloudfront_access_log_create_bucket` is `true`. | `list(string)` | <pre>[<br> "logs"<br>]</pre> | no |
| <a name="input_extra_origin_attributes"></a> [extra\_origin\_attributes](#input\_extra\_origin\_attributes) | Additional attributes to put onto the origin label | `list(string)` | <pre>[<br> "origin"<br>]</pre> | no |
| <a name="input_forward_cookies"></a> [forward\_cookies](#input\_forward\_cookies) | Specifies whether you want CloudFront to forward all or no cookies to the origin. Can be 'all' or 'none' | `string` | `"none"` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Expand Up @@ -86,6 +86,7 @@
| <a name="input_encryption_enabled"></a> [encryption\_enabled](#input\_encryption\_enabled) | When set to 'true' the resource will have aes256 encryption enabled by default | `bool` | `true` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| <a name="input_error_document"></a> [error\_document](#input\_error\_document) | An absolute path to the document to return in case of a 4XX error | `string` | `""` | no |
| <a name="input_external_aliases"></a> [external\_aliases](#input\_external\_aliases) | List of FQDN's - Used to set the Alternate Domain Names (CNAMEs) setting on Cloudfront. No new route53 records will be created for these | `list(string)` | `[]` | no |
| <a name="input_extra_logs_attributes"></a> [extra\_logs\_attributes](#input\_extra\_logs\_attributes) | Additional attributes to add to the end of the generated Cloudfront Access Log S3 Bucket name.<br>Only effective if `cloudfront_access_log_create_bucket` is `true`. | `list(string)` | <pre>[<br> "logs"<br>]</pre> | no |
| <a name="input_extra_origin_attributes"></a> [extra\_origin\_attributes](#input\_extra\_origin\_attributes) | Additional attributes to put onto the origin label | `list(string)` | <pre>[<br> "origin"<br>]</pre> | no |
| <a name="input_forward_cookies"></a> [forward\_cookies](#input\_forward\_cookies) | Specifies whether you want CloudFront to forward all or no cookies to the origin. Can be 'all' or 'none' | `string` | `"none"` | no |
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Expand Up @@ -270,7 +270,7 @@ resource "aws_s3_bucket" "origin" {
}
korenyoni marked this conversation as resolved.
Show resolved Hide resolved

dynamic "cors_rule" {
for_each = distinct(compact(concat(var.cors_allowed_origins, var.aliases)))
for_each = distinct(compact(concat(var.cors_allowed_origins, var.aliases, var.external_aliases)))
mburns marked this conversation as resolved.
Show resolved Hide resolved
mburns marked this conversation as resolved.
Show resolved Hide resolved
mburns marked this conversation as resolved.
Show resolved Hide resolved
content {
allowed_headers = var.cors_allowed_headers
allowed_methods = var.cors_allowed_methods
Expand Down Expand Up @@ -338,7 +338,7 @@ resource "aws_cloudfront_distribution" "default" {
}
}

aliases = var.acm_certificate_arn != "" ? var.aliases : []
aliases = var.acm_certificate_arn != "" ? concat(var.aliases, var.external_aliases) : []
mburns marked this conversation as resolved.
Show resolved Hide resolved

dynamic "origin_group" {
for_each = var.origin_groups
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Expand Up @@ -27,6 +27,12 @@ variable "aliases" {
default = []
}

variable "external_aliases" {
type = list(string)
description = "List of FQDN's - Used to set the Alternate Domain Names (CNAMEs) setting on Cloudfront. No new route53 records will be created for these"
default = []
}

variable "additional_bucket_policy" {
type = string
default = "{}"
Expand Down