Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshbeard/tf-aws-site
Terraform module for my common websites deployed in AWS
https://github.com/joshbeard/tf-aws-site
aws cloudfront route53 s3 terraform terraform-modules website
Last synced: 2 days ago
JSON representation
Terraform module for my common websites deployed in AWS
- Host: GitHub
- URL: https://github.com/joshbeard/tf-aws-site
- Owner: joshbeard
- License: 0bsd
- Created: 2022-03-10T05:01:43.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-07T05:33:46.000Z (9 months ago)
- Last Synced: 2025-01-19T20:08:21.360Z (8 days ago)
- Topics: aws, cloudfront, route53, s3, terraform, terraform-modules, website
- Language: HCL
- Homepage:
- Size: 186 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple AWS Site Terraform Module
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/e0b629fbd8644ecbbc5432be24c64947)](https://www.codacy.com/gh/joshbeard/tf-aws-site/dashboard?utm_source=github.com&utm_medium=referral&utm_content=joshbeard/tf-aws-site&utm_campaign=Badge_Grade)
[![CodeFactor](https://www.codefactor.io/repository/github/joshbeard/tf-aws-site/badge)](https://www.codefactor.io/repository/github/joshbeard/tf-aws-site)This is a personal Terraform module for deploying a simple website on AWS.
* S3 bucket for the site with logging bucket
* CloudFront distribution
* Route53 DNS management with common records for my own hosts.
* ACM for managing SSL certificates
* IAM policy and user for deployment## Usage
```terraform
module "somesite_aws" {
source = "[email protected]:joshbeard/tf-aws-site.git"domain = "somesite.org"
}
```## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0.0 |
| [aws](#requirement\_aws) | ~> 4.0 |## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | 4.4.0 |
| [aws.cert](#provider\_aws.cert) | 4.4.0 |## Modules
| Name | Source | Version |
|------|--------|---------|
| [cloudfront\_logs](#module\_cloudfront\_logs) | ./cloudfront-logs | n/a |## Resources
| Name | Type |
|------|------|
| [aws_acm_certificate.site](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/acm_certificate) | resource |
| [aws_acm_certificate_validation.site](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/acm_certificate_validation) | resource |
| [aws_cloudfront_distribution.site_distribution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution) | resource |
| [aws_iam_policy.site_deploy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
| [aws_iam_user.site_deployer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user) | resource |
| [aws_iam_user_policy_attachment.site_deploy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user_policy_attachment) | resource |
| [aws_route53_record.site-root-a](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
| [aws_route53_record.site-www-a](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
| [aws_route53_record.site_acm_validate](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
| [aws_route53_zone.site](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone) | resource |
| [aws_s3_bucket.site](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket.site_logs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_acl.site](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_acl) | resource |
| [aws_s3_bucket_acl.site_logs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_acl) | resource |
| [aws_s3_bucket_cors_configuration.site](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_cors_configuration) | resource |
| [aws_s3_bucket_logging.site](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_logging) | resource |
| [aws_s3_bucket_policy.site_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_website_configuration.site](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_website_configuration) | resource |
| [aws_iam_policy_document.site_deploy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.site_policies](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [bucket\_name](#input\_bucket\_name) | The name of the S3 bucket to manage for the web content. By default, this is s3-website-DOMAINSLUG | `string` | `null` | no |
| [cf\_aliases](#input\_cf\_aliases) | Aliases for the CloudFront distribution. By default, domain and www.domain are added. | `list(any)` | `[]` | no |
| [cf\_default\_ttl](#input\_cf\_default\_ttl) | The default TTL for the CloudFront distribution default behavior. | `number` | `2592000` | no |
| [cf\_logs](#input\_cf\_logs) | Enables or disables CloudFront log collection into CloudWatch via Lambda. | `bool` | `true` | no |
| [cf\_max\_ttl](#input\_cf\_max\_ttl) | The maximum TTL for the CloudFront distribution default behavior. | `number` | `7776000` | no |
| [cf\_min\_ttl](#input\_cf\_min\_ttl) | The minimum TTL for the CloudFront distribution default behavior. | `number` | `0` | no |
| [domain](#input\_domain) | The DNS name of the site. | `string` | n/a | yes |
| [iam\_name](#input\_iam\_name) | The name to give IAM resources. By default, this is s3-deployer-DOMAINSLUG | `string` | `null` | no |
| [log\_bucket\_name](#input\_log\_bucket\_name) | The name of the S3 bucket to manage for logging. By default, this is s3-website-DOMAINSLUG-logs | `string` | `null` | no |
| [log\_prefix](#input\_log\_prefix) | The prefix (path) for logs in the logging bucket. By default, this is the value of 'domain' | `string` | `null` | no |
| [region](#input\_region) | The AWS region | `string` | `"us-west-2"` | no |
| [subject\_alternative\_names](#input\_subject\_alternative\_names) | Additional subject\_alternative\_names to add to the certificate request (ACM). By default, *.domain is added. | `list(any)` | `[]` | no |
| [tags](#input\_tags) | Map of tags to apply to all resources. | `map(any)` | `{}` | no |## Outputs
| Name | Description |
|------|-------------|
| [acm\_arn](#output\_acm\_arn) | The ARN of the certificate in ACM. |
| [acm\_domain\_name](#output\_acm\_domain\_name) | The domain name of the certificate in ACM. |
| [acm\_domain\_status](#output\_acm\_domain\_status) | The status of the certificate in ACM. |
| [acm\_id](#output\_acm\_id) | The ID of the certificate in ACM. |
| [cloudfront\_aliases](#output\_cloudfront\_aliases) | List of aliases for the CloudFront distribution. |
| [cloudfront\_arn](#output\_cloudfront\_arn) | The ARN of the CloudFront distribution. |
| [cloudfront\_domain\_name](#output\_cloudfront\_domain\_name) | The domain name of the CloudFront distribution. |
| [cloudfront\_id](#output\_cloudfront\_id) | The ID of the CloudFront distribution. |
| [iam\_deploy\_policy\_arn](#output\_iam\_deploy\_policy\_arn) | The ARN of the IAM policy used by the IAM user for deployment. |
| [iam\_deploy\_policy\_name](#output\_iam\_deploy\_policy\_name) | The name of the IAM policy used by the IAM user for deployment. |
| [iam\_deploy\_user\_arn](#output\_iam\_deploy\_user\_arn) | The ARN of the IAM user used for deployment. |
| [iam\_deploy\_user\_name](#output\_iam\_deploy\_user\_name) | The name of the IAM user used for deployment. |
| [route53\_name\_servers](#output\_route53\_name\_servers) | List of name servers for the Route53 zone. |
| [route53\_zone\_arn](#output\_route53\_zone\_arn) | The ARN of the Route53 zone. |
| [route53\_zone\_id](#output\_route53\_zone\_id) | The ID of the Route53 zone. |
| [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | The ARN of the S3 bucket containing the web content. |
| [s3\_bucket\_domain\_name](#output\_s3\_bucket\_domain\_name) | The AWS domain of the S3 bucket containing the web content. |
| [s3\_bucket\_name](#output\_s3\_bucket\_name) | The name of the S3 bucket containing the web content. |
| [s3\_bucket\_regional\_domain\_name](#output\_s3\_bucket\_regional\_domain\_name) | The AWS regional domain of the S3 bucket containing the web content. |
| [s3\_bucket\_website\_domain](#output\_s3\_bucket\_website\_domain) | The AWS website domain of the S3 bucket containing the web content. |
| [s3\_bucket\_website\_endpoint](#output\_s3\_bucket\_website\_endpoint) | The AWS website endpoint of the S3 bucket containing the web content. |