A Terraform definition to deploy your static website on AWS.
- AWS CLI connected to an AWS account.
- Terraform CLI.
- A hosted zone in AWS Route53 with the domain name you want to use.
Create a folder inside the live
directory and create a new main.tf file with the following:
module "###YOUR_MODULE_NAME###" {
source = "../../modules/s3-website"
domain_name = "###YOUR_DOMAIN_NAME###"
route53_zone_name = "###YOUR_ROUTE53_ZONE_NAME###"
secret = "###YOUR_SECRET_KEY###"
}
output "website_endpoint" {
value = module.###YOUR_MODULE_NAME###.website_endpoint
}
output "website_domain_name" {
value = module.###YOUR_MODULE_NAME###.website_domain_name
}
No requirements.
Name | Type |
---|---|
aws_acm_certificate.cert | resource |
aws_acm_certificate_validation.cert | resource |
aws_cloudfront_distribution.cdn | resource |
aws_iam_access_key.deploy | resource |
aws_iam_user.deploy | resource |
aws_iam_user_policy.deploy | resource |
aws_route53_record.static_site | resource |
aws_route53_record.validation | resource |
aws_s3_bucket.redirect | resource |
aws_s3_bucket.static_site | resource |
aws_s3_bucket_policy.static_site_policy | resource |
aws_s3_bucket_website_configuration.redirect | resource |
aws_s3_bucket_website_configuration.static_site | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
domain_name | DNS name of the website. | any |
n/a | yes |
route53_zone_name | Route53 zone name to use. | any |
n/a | yes |
secret | Secret key | any |
n/a | yes |
Name | Description |
---|---|
website_domain_name | The public url of this website. |
website_endpoint | The public url of this website in AWS s3. |
NOTE: Manual changes to the README will be overwritten when the documentation is updated. To update the documentation, run terraform-docs -c ./.config/terraform-docs.yml ./modules/s3-website/ && mv ./modules/s3-website/README.md .