Skip to content

Commit a3f993d

Browse files
chore: update docs and setup for next release (#4)
1 parent fc601e7 commit a3f993d

File tree

3 files changed

+126
-3
lines changed

3 files changed

+126
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
# Terraform AWS Complete Static Site Module
33

4-
[![Terraform](https://img.shields.io/badge/Terraform-0.12.0-623CE4)](https://www.terraform.io)
4+
[![Terraform registry](https://img.shields.io/badge/Terraform_Registry-0.0.2-blue)](https://registry.terraform.io/modules/iKnowJavaScript/complete-static-site/aws/latest)
5+
[![Terraform](https://img.shields.io/badge/Terraform-0.0.2-623CE4)](https://www.terraform.io)
56
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
67

78
This Terraform module consist the configuration for hosting a static website on AWS. It creates and configures the necessary AWS resources including S3, Route 53 (DNS), IAM, CloudFront, and WAF.
@@ -18,14 +19,15 @@ This module provisions:
1819
- IAM user
1920
- S3 bucket
2021

22+
### Architecture Diagram
2123
![image](assets/diagram.png)
2224

2325
## Usage
2426

2527
### Example with a custom domain (sub domain)
2628
```hcl
2729
module "frontend" {
28-
source = "github.com/iKnowJavaScript/terraform-aws-complete-static-site"
30+
source = "iKnowJavaScript/complete-static-site/aws"
2931
3032
name = "example-website"
3133
environment = "prod"
@@ -44,7 +46,7 @@ provider "aws" {
4446
### Example with default CloudFlare domain
4547
```hcl
4648
module "frontend" {
47-
source = "github.com/iKnowJavaScript/terraform-aws-complete-static-site"
49+
source = "iKnowJavaScript/complete-static-site/aws"
4850
4951
name = "example-website"
5052
environment = "prod"
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Example Website Terraform Module with Custom Sub domain
2+
3+
This Terraform module is utilized for deploying a static website on AWS with a custom subdomain, leveraging resources such as S3, CloudFront, Route 53, WAF, and IAM.
4+
5+
## Overview
6+
7+
Using this module, users can easily create a production-ready static website hosted on AWS infrastructure. With features like a secure S3 bucket for website content, CloudFront for optimized delivery, WAF WebACL for site protection, and a custom domain setup through Route 53, the module simplifies the way static websites are deployed and managed.
8+
9+
The configuration also includes an IAM user for facilitating continuous deployment processes directly to the S3 bucket.
10+
11+
### Architecture Diagram
12+
13+
![](../../assets/diagram.png)
14+
15+
## How to Use This Module
16+
17+
Below is an example of how you can use this module in your Terraform configuration to set up a static website with a custom subdomain.
18+
19+
```hcl
20+
module "website" {
21+
source = "../../"
22+
23+
name = "example-website"
24+
environment = "prod"
25+
hosted_zone_domain = "example.com"
26+
custom_domain_name = "example-website.example.com"
27+
create_custom_domain = true
28+
aws_region = "us-east-2"
29+
}
30+
```
31+
32+
Make sure to include the `aws` provider block in your configuration:
33+
34+
```hcl
35+
provider "aws" {
36+
region = "us-east-2"
37+
}
38+
```
39+
40+
### Inputs for Custom Domain Setup
41+
42+
| Name | Description | Type | Default | Required |
43+
|---------------------|---------------------------------------------------------------------|------------|---------|:--------:|
44+
| `name` | The project/site name | `string` | n/a | yes |
45+
| `environment` | The environment (e.g., staging, prod) | `string` | n/a | yes |
46+
| `hosted_zone_domain`| Your hosted zone domain in Route 53 | `string` | n/a | yes |
47+
| `custom_domain_name`| The full custom subdomain to set up | `string` | n/a | yes |
48+
| `create_custom_domain` | A flag indicating whether to create a custom domain | `bool` | `true` | no |
49+
| `aws_region` | AWS region where resources will be created | `string` | n/a | yes |
50+
51+
### Outputs
52+
53+
| Name | Description | Sensitive |
54+
|---------------------------|---------------------------------------------|:---------:|
55+
| `cloudflare_domain` | The direct CloudFront domain | No |
56+
| `custom_domain` | The custom domain name | No |
57+
| `bucket_name` | The name of the S3 bucket | No |
58+
| `access_key_id` | Access key ID for the S3 user | No |
59+
| `secret_access_key` | Secret access key for the S3 user | Yes |
60+
| `domain_certificate_arn` | The ARN of the domain certificate | No |
61+
62+
Sensitive information like the `secret_access_key` can be accessed using the Terraform CLI command `terraform output secret_access_key`.
63+
64+
## License
65+
66+
This code is provided under the MIT License. See the included [LICENSE.md](LICENSE.md) file for more information.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Example Website Terraform Module without Custom Domain
2+
3+
Deploy your static website on AWS without the need for a custom domain using this Terraform module. It provisions essential resources such as an S3 bucket, CloudFront distribution, and IAM user for secure and efficient hosting.
4+
5+
## Overview
6+
7+
This module sets up a static website hosting environment optimized for production use. By creating a secure S3 bucket to host your content, setting up a CloudFront distribution for fast global access, and establishing IAM security for continuous deployment processes, the module offers a straightforward approach to deploying static websites on AWS.
8+
9+
### Architecture Diagram
10+
11+
![](../../assets/diagram.png)
12+
13+
## How to Use This Module
14+
15+
To deploy your static website without a custom domain, you can use the module in your Terraform configuration like so:
16+
17+
```hcl
18+
module "website" {
19+
source = "../../"
20+
21+
name = "example-website"
22+
environment = "prod"
23+
create_custom_domain = false
24+
aws_region = "us-east-2"
25+
}
26+
27+
provider "aws" {
28+
region = "us-east-2"
29+
}
30+
```
31+
32+
### Inputs for Default Domain Setup
33+
34+
| Name | Description | Type | Default | Required |
35+
|-------------------------|--------------------------------------------------------|----------|---------|:--------:|
36+
| `name` | The project/site name | `string` | n/a | yes |
37+
| `environment` | The environment (e.g., staging, prod) | `string` | n/a | yes |
38+
| `create_custom_domain` | A flag indicating whether to create a custom domain | `bool` | `false` | no |
39+
| `aws_region` | AWS region where resources will be created | `string` | n/a | yes |
40+
41+
### Outputs
42+
43+
| Name | Description | Sensitive |
44+
|---------------------------|------------------------------------------|:---------:|
45+
| `cloudflare_domain` | The direct CloudFront domain | No |
46+
| `bucket_name` | The name of the S3 bucket | No |
47+
| `access_key_id` | Access key ID for the S3 user | No |
48+
| `secret_access_key` | Secret access key for the S3 user | Yes |
49+
| `domain_certificate_arn` | The ARN of the default domain certificate| No |
50+
51+
To retrieve sensitive outputs like the `secret_access_key`, use the `terraform output` command with caution, for example: `terraform output secret_access_key`.
52+
53+
## License
54+
55+
This code is provided under the MIT License. Full licensing details are available in the included [LICENSE.md](LICENSE.md) file.

0 commit comments

Comments
 (0)