An open API service indexing awesome lists of open source software.

https://github.com/nulllogic/terraform-aws-website-static-cloudfront-s3

🚀 By using this Terraform module, you can save time and effort in setting up your AWS static website. Its comprehensive Terraform code and thoughtful configuration options allow you to create a reliable, scalable, and performant static website on AWS without any problems.
https://github.com/nulllogic/terraform-aws-website-static-cloudfront-s3

Last synced: 4 months ago
JSON representation

🚀 By using this Terraform module, you can save time and effort in setting up your AWS static website. Its comprehensive Terraform code and thoughtful configuration options allow you to create a reliable, scalable, and performant static website on AWS without any problems.

Awesome Lists containing this project

README

        

# Terraform AWS static website module



Logo



contributors


last update


forks


stars


open issues


license

The main objective of this module is to leverage the power of AWS services, specifically CloudFront and S3, to host and deliver your static website efficiently and securely. By utilizing Terraform's infrastructure as code capabilities, this project streamlines the deployment process, making it easy for you to set up and manage your AWS static website.





NullLogic


## ┌ Table of Contents ┐

- [Requirements](#-requirements-)
- [Key Features](#-key-features-)
- [Quick Start](#-quick-start-)
- [Module Examples](#-module-examples-)

## ┌ Requirements ┐

🗯️ Mandatory

1. 🐳 Docker ( [download](https://docs.docker.com/get-docker/) )
2. 🤖 AWS account + security keys ( [instruction](https://aws.amazon.com/blogs/security/wheres-my-secret-access-key/) )
1. `aws_access_key_id`
2. `aws_secret_access_key`

💭️ Optional

1. Domain, located in [Amazon AWS Route53](https://aws.amazon.com/route53/)

## ┌ Key Features ┐

⚙️ Zero-config, **one-minute setup** with a **single CLI command**

🔐 AWS providers for smooth **deployment** and **certificate** generation

⚡ Out-of-the-box support for **static website**

💪 Future-proof, **robust architecture**

🐳 Docker commands under the hood

✅ Full **test coverage**

🔒 Additional **security** headers

## ┌ Quick Start ┐

By using this project, you can save time and effort in setting up your AWS static website. Its comprehensive Terraform code and thoughtful configuration options allow you to create a reliable, scalable, and performant static website on AWS without any problems.

Feel free to explore the project on [GitHub](https://github.com/nulllogic/terraform-aws-website-static-cloudfront-s3). Happy coding!

1st step:

Download two files `main.tf` and `provider.tf` from one of examples directories.

2nd step:

Run one of the following commands inside directory with those two files.

( it will use docker image with HashiCorp with TerraForm application inside)

If you have used AWS CLI already, you can attach keys by running this command:

```
docker container run -it --rm -v $PWD:/tf -v ~/.aws:/root/.aws --workdir /tf hashicorp/terraform:latest init
```

If you haven't used AWS CLI, you can pass those keys directly, by running this command:
( don't forget to replace XXXX with your AWS keys )
```
docker container run -it --rm -e TF_VAR_aws_access_key_id=XXXXXXXX -e TF_VAR_aws_secret_access_key=XXXXXXX -v $PWD:/tf --workdir /tf hashicorp/terraform:latest init
```

3rd step:

Run the command, that you used previously, but instead of `init` at the end of the command, write `apply`

It should look like this :
```
docker container run -it --rm -v $PWD:/tf -v ~/.aws:/root/.aws --workdir /tf hashicorp/terraform:latest apply
```

4th step:

Run the command, that you used previously, but instead of `apply` at the end of the command, write `deploy`

It should look like this :
```
docker container run -it --rm -v $PWD:/tf -v ~/.aws:/root/.aws --workdir /tf hashicorp/terraform:latest deploy
```

5th step:

Profit ! 💪


## ┌ Module Examples ┐

Example 1 -> CloudFront + S3

```hcl
module "website-static-cloudfront-s3" {
source = "nulllogic/website-static-cloudfront-s3/aws"

tags = {
Environment = "dev"
Terraform = "true"
}
}
```




Example 1


Example 2 -> CloudFront + S3 + Domain

```hcl
module "website-static-cloudfront-s3" {
source = "nulllogic/website-static-cloudfront-s3/aws"

route53 = {
domain = "example.com"
}

tags = {
Environment = "dev"
Terraform = "true"
}
}
```




Example 2

## ┌ Contributing ┐

See [Contributing](https://github.com/nulllogic/terraform-aws-website-static-cloudfront-s3/tree/master/CONTRIBUTING.md)

## ┌ Changelog ┐

See [Changelog](https://github.com/nulllogic/terraform-aws-website-static-cloudfront-s3/tree/master/CHANGELOG.md)

## ┌ License ┐

Licensed under the MIT [License](https://github.com/nulllogic/terraform-aws-website-static-cloudfront-s3/tree/master/LICENSE.md)