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
Copy file name to clipboardExpand all lines: README.md
+25-14Lines changed: 25 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,44 +6,55 @@ Terraform module which provision required AWS resources to host a performant and
6
6
7
7
## Features
8
8
9
-
This Terraform module will create the following AWS resources:
9
+
This Terraform module creates the following AWS resources:
10
10
11
-
***AWS Certificate Manager** to create a wildcard certificate for your domain.
11
+
***AWS Certificate Manager**: wildcard certificate for your domain.
12
12
***S3**
13
-
*One bucket to store static public files.
14
-
*One bucket to redirect a different subdomain to the main domain.
15
-
*One bucket to store access logs.
13
+
*Bucket #1: to store logs.
14
+
*Bucket #2: to store the content (`example.com`).
15
+
*Bucket #3: to redirect a different subdomain to the main domain (e.g., `www.example.com` redirected to `example.com`).
16
16
***CloudFront**
17
-
*One distribution to frontend the website.
18
-
*One distribution to frontend the sub-domain that will be redirect to the main domain.
17
+
*Distribution #1: to frontend the website.
18
+
*Distribution #2: to frontend the subdomain that will be redirect to the main domain.
19
19
***Lambda@Edge** (triggered by the CloudFront Distribution) to re-write requests so that CloudFront requests a default index object (e.g., index.html) for subfolders.
20
-
***Route53** record sets pointing to the CloudFront distributions.
20
+
***Route53** record sets pointing to the two CloudFront distributions.
21
21
22
22
## Requirements
23
23
24
24
* This module is meant for use with [Terraform](https://www.terraform.io/downloads.html) 0.12+. It has not been tested with previous versions of Terraform.
25
-
* An AWS account and your credentials (`aws_access_key_id` and `aws_secret_access_key`) stored in a [credential file](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html).
25
+
* An AWS account and your credentials (`aws_access_key_id` and `aws_secret_access_key`) configured. There are several ways to do this (environment variables, shared credentials file, etc.): my preference is to store them in a [credential file](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html). More information in the [AWS Provider](https://www.terraform.io/docs/providers/aws/index.html) documentation.
26
26
* Your domain already configured as a hosted zone on Route53.
27
27
28
28
## Usage
29
29
30
30
```HCL
31
+
provider "aws" {
32
+
version = "~> 2.0"
33
+
region = "eu-west-3"
34
+
shared_credentials_file = "~/.aws/credentials"
35
+
}
36
+
31
37
module "aws_static_website" {
32
38
source = "cloudmaniac/static-website/aws"
33
39
34
-
aws-region-default = "eu-west-3"
35
-
website-domain-main = "cluster.net"
36
-
website-domain-redirect = "www.cluster.net"
40
+
website-domain-main = "example.com"
41
+
website-domain-redirect = "www.example.com"
37
42
}
38
43
```
39
44
45
+
Although AWS services are available in many locations, some of them require the `us-east-1` (N. Virginia) region to be configured:
46
+
47
+
* To use an ACM certificate with Amazon CloudFront, you must request or import the certificate in the US East (N. Virginia) region. ACM certificates in this region that are associated with a CloudFront distribution are distributed to all the geographic locations configured for that distribution.
48
+
* Lambda@Edge functions can now be authored in US East (N. Virginia), and will be replicated globally for invocation in response to CloudFront events.
49
+
50
+
For those reasons, the module includes an aliased provider definition to create those resources in the `us-east-1` region. Remaining resources from the module will inherit default (un-aliased) provider configurations from the parent.
51
+
40
52
## Inputs
41
53
42
54
| Name | Description | Type | Default | Required |
0 commit comments