Skip to content

Commit f324a2e

Browse files
committed
Updated documentation and linted codebase
1 parent d962d2f commit f324a2e

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ of configuration elements from the bundle being served, allowing the bundle to b
1111

1212
This module also has an additional and separate artifactory module - more information on what this module provides can be found in the [Artifactory README](artifactory/README.md)
1313

14+
### React client side routing support
15+
16+
In order to support React's client side routing implementation, you'll need to provide the following value for the `cloudfront_custom_errors` variable as follows
17+
18+
```
19+
cloudfront_custom_errors = [
20+
{
21+
error_caching_min_ttl = 300
22+
error_code = 404
23+
response_code = 200
24+
response_page_path = "/index.html"
25+
}]
26+
```
27+
28+
The `response_page_path` (`/index.html` in this example) should match your static html file that invokes the React bundle. Further explanations for the settings can be found at https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html#custom-error-response-arguments.
29+
1430
### Implementation patterns
1531

1632
This module is used to provide the infrastructure for both serving static content in a way that creates pipeline building blocks that allows users to easily construct a pipeline to provide continuous delivery patterns. An example pipeline is shown below:
@@ -27,6 +43,8 @@ This repo supports version 0.11 and 0.12 of Terraform. The implementation patter
2743
## Contributions
2844
All contributions are accepted, details on how to contribute can be found in [contrib.md](contrib.md).
2945

46+
---
47+
3048
## Providers
3149

3250
| Name | Version |
@@ -45,6 +63,7 @@ All contributions are accepted, details on how to contribute can be found in [co
4563
| url | The custom URL to access the site. Must match the certificate name to provide a valid TLS connection. | `any` | n/a | yes |
4664
| cloudfront\_allowed\_methods | Controls which HTTP methods CloudFront processes and forwards to your Amazon S3 bucket or your custom origin. | `list(string)` | <pre>[<br> "GET",<br> "HEAD",<br> "OPTIONS"<br>]<br></pre> | no |
4765
| cloudfront\_cached\_methods | Controls whether CloudFront caches the response to requests using the specified HTTP methods. | `list(string)` | <pre>[<br> "GET",<br> "HEAD"<br>]<br></pre> | no |
66+
| cloudfront\_custom\_errors | A map of custom error settings for the CloudFront Distribution | <pre>list(object({<br>error_caching_min_ttl = number<br>error_code = number<br>response_code = number<br>response_page_path = string<br>}))<br></pre> | `[]` | no |
4867
| cloudfront\_tags | Additional tags to be added to all cloudfront resources. | `map(any)` | `{}` | no |
4968
| comment | A comment for the Cloudfront distribution resource | `string` | `""` | no |
5069
| cors\_allowed\_methods | Specifies which methods are allowed. Can be GET, PUT, POST, DELETE or HEAD. Defaults to `GET`, `PUT`, `POST`. | `list(string)` | <pre>[<br> "GET",<br> "PUT",<br> "POST"<br>]<br></pre> | no |

outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ output "s3_bucket_hosted_id" {
1515

1616
output "cloudfront_url" {
1717
description = "The URL for the Cloudfront Distribution - used to set the alias for the custom domain."
18-
value = element(concat(aws_cloudfront_distribution.cdn.*.domain_name, list("")),0)
18+
value = element(concat(aws_cloudfront_distribution.cdn.*.domain_name, list("")), 0)
1919
}
2020

2121
output "cloudfront_hosted_zone" {
2222
description = "The hosted zone id of the Cloudfront Distribution"
23-
value = element(concat(aws_cloudfront_distribution.cdn.*.hosted_zone_id, list("")),0)
23+
value = element(concat(aws_cloudfront_distribution.cdn.*.hosted_zone_id, list("")), 0)
2424
}

vars.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ variable "url" {
5656

5757
variable cloudfront_custom_errors {
5858
description = "A map of custom error settings for the CloudFront Distribution"
59-
type = list(object({
59+
type = list(object({
6060
error_caching_min_ttl = number
6161
error_code = number
6262
response_code = number
6363
response_page_path = string
6464
}))
65-
default = []
65+
default = []
6666
}
6767
variable "cloudfront_allowed_methods" {
6868
description = " Controls which HTTP methods CloudFront processes and forwards to your Amazon S3 bucket or your custom origin."

0 commit comments

Comments
 (0)