From 2e06c40de03ee8be353eff7cf58ff9e5b6718cbd Mon Sep 17 00:00:00 2001 From: Andrey Date: Sat, 4 Jan 2025 20:04:08 -0300 Subject: [PATCH 1/2] fix: readme typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d1a65a..f13c767 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This module provisions the infrasructure required for a static website hosted on - Domain Name - [Route 53 Hosted zone](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/hosted-zones-working-with.html) which is the DNS provider for the domain. [Making Amazon Route 53 the DNS service for an existing domain](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html). Note: the hosted zone only needs to manage the DNS service, domain registration does not need to be migrated! - - [A second aws porovider configured in us-east-1](https://www.terraform.io/language/providers/configuration) as CloudFront and SSL certificates are only available in us-east-1. + - [A second aws provider configured in us-east-1](https://www.terraform.io/language/providers/configuration) as CloudFront and SSL certificates are only available in us-east-1. For syncronisation of the website content with a local directory, the following is required: - [AWS CLI](https://aws.amazon.com/cli/) installed locally - [installation instructions](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) From e910291f759dedf3816c87609be0cbbf964cad2c Mon Sep 17 00:00:00 2001 From: Andrey Date: Sat, 4 Jan 2025 20:05:04 -0300 Subject: [PATCH 2/2] improving readme --- README.md | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index f13c767..2b5f4ca 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This module provisions the infrasructure required for a static website hosted on - [CloudFront Distribution](https://aws.amazon.com/cloudfront/) to serve the website at edge locations at a low cost and high performance. - [Route 53](https://aws.amazon.com/route53/) A records to utilise custom domain on website. - Security First - S3 Bucket is private with IAM policies to provide permissions to CloudFront. - - Utilises aws S3 sync command to upload website content to S3 Bucket. + - Utilises `aws S3 sync` command to upload website content to S3 Bucket. ![image](https://raw.githubusercontent.com/DevOpsNavy/terraform-aws-s3-cloudfront-static-website/v0.0.0/diagrams/Architecture.drawio.png) @@ -16,17 +16,17 @@ This module provisions the infrasructure required for a static website hosted on - Domain Name - [Route 53 Hosted zone](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/hosted-zones-working-with.html) which is the DNS provider for the domain. [Making Amazon Route 53 the DNS service for an existing domain](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html). Note: the hosted zone only needs to manage the DNS service, domain registration does not need to be migrated! - - [A second aws provider configured in us-east-1](https://www.terraform.io/language/providers/configuration) as CloudFront and SSL certificates are only available in us-east-1. + - [A second aws provider configured in us-east-1](https://www.terraform.io/language/providers/configuration) as CloudFront and SSL certificates are only available in `us-east-1`. For syncronisation of the website content with a local directory, the following is required: - [AWS CLI](https://aws.amazon.com/cli/) installed locally - [installation instructions](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) - - [Configure a named profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) using `aws configure --profile NAME` command. This is used for the aws s3 sync command which is executed locally. Profiles are preferred over keys and secrets. + - [Configure a named profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) using `aws configure --profile NAME` command. This is used for the `aws s3 sync` command which is executed locally. Profiles are preferred over keys and secrets. ## Usage [Example available here](https://github.com/DevOpsNavy/s3-cloudfront-static-website/tree/main/examples/static_website_with_sync) -```javascript +```hcl terraform { required_providers { aws = { @@ -50,7 +50,6 @@ provider "aws" { } module "website" { - source = "XXX" resource_uid = "DevOpsNavy" @@ -124,11 +123,11 @@ No modules. | [default\_cache\_methods](#input\_default\_cache\_methods) | Controls whether CloudFront caches the response to requests using the specified HTTP methods. | `list(string)` |
[
"GET",
"HEAD",
"OPTIONS"
]
| no | | [default\_cache\_min\_ttl](#input\_default\_cache\_min\_ttl) | The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront queries your origin to see whether the object has been updated. | `number` | `0` | no | | [default\_cache\_viewer\_protocol\_policy](#input\_default\_cache\_viewer\_protocol\_policy) | Use this element to specify the protocol that users can use to access the files in the origin specified by TargetOriginId when a request matches the path pattern in PathPattern. One of allow-all, https-only, or redirect-to-https. | `string` | `"redirect-to-https"` | no | -| [default\_root\_object](#input\_default\_root\_object) | The object that you want CloudFront to return (for example, index.html) when an end user requests the root URL. | `string` | `"index.html"` | no | +| [default\_root\_object](#input\_default\_root\_object) | The object that you want CloudFront to return (for example, `index.html`) when an end user requests the root URL. | `string` | `"index.html"` | no | | [domain\_name](#input\_domain\_name) | The domain name for the website. | `string` | n/a | yes | | [enable\_cloudfront\_distribution](#input\_enable\_cloudfront\_distribution) | Whether the distribution is enabled to accept end user requests for content. | `bool` | `true` | no | | [hosted\_zone\_id](#input\_hosted\_zone\_id) | The Hosted Zone ID. This is automatically generated and can be referenced by zone records. | `string` | n/a | yes | -| [profile](#input\_profile) | Credentials profile to use for aws s3 sync command | `string` | n/a | yes | +| [profile](#input\_profile) | Credentials profile to use for `aws s3 sync command` | `string` | n/a | yes | | [resource\_uid](#input\_resource\_uid) | UID which will be prepended to resources created by this module | `string` | n/a | yes | | [sync\_directories](#input\_sync\_directories) | Directories to sync with S3 |
list(object({
local_source_directory = string
s3_target_directory = string
}))
| `[]` | no | @@ -140,31 +139,31 @@ No modules. | [acm\_certificate\_domain\_name](#output\_acm\_certificate\_domain\_name) | The domain name for which the certificate is issued | | [acm\_certificate\_status](#output\_acm\_certificate\_status) | Status of the certificate. | | [acm\_certificate\_validation\_id](#output\_acm\_certificate\_validation\_id) | The time at which the certificate was issued | -| [cloudfront\_distribution\_arn](#output\_cloudfront\_distribution\_arn) | The ARN (Amazon Resource Name) for the distribution. For example: arn:aws:cloudfront::123456789012:distribution/EDFDVBD632BHDS5, where 123456789012 is your AWS account ID. | +| [cloudfront\_distribution\_arn](#output\_cloudfront\_distribution\_arn) | The ARN (Amazon Resource Name) for the distribution. For example: `arn:aws:cloudfront::123456789012:distribution/EDFDVBD632BHDS5`, where 123456789012 is your AWS account ID. | | [cloudfront\_distribution\_caller\_reference](#output\_cloudfront\_distribution\_caller\_reference) | Internal value used by CloudFront to allow future updates to the distribution configuration. | -| [cloudfront\_distribution\_domain\_name](#output\_cloudfront\_distribution\_domain\_name) | The domain name corresponding to the distribution. For example: d604721fxaaqy9.cloudfront.net. | -| [cloudfront\_distribution\_etag](#output\_cloudfront\_distribution\_etag) | The current version of the distribution's information. For example: E2QWRUHAPOMQZL. | -| [cloudfront\_distribution\_hosted\_zone\_id](#output\_cloudfront\_distribution\_hosted\_zone\_id) | The CloudFront Route 53 zone ID that can be used to route an Alias Resource Record Set to. This attribute is simply an alias for the zone ID Z2FDTNDATAQYW2. | -| [cloudfront\_distribution\_id](#output\_cloudfront\_distribution\_id) | The identifier for the distribution. For example: EDFDVBD632BHDS5. | +| [cloudfront\_distribution\_domain\_name](#output\_cloudfront\_distribution\_domain\_name) | The domain name corresponding to the distribution. For example: `d604721fxaaqy9.cloudfront.net`. | +| [cloudfront\_distribution\_etag](#output\_cloudfront\_distribution\_etag) | The current version of the distribution's information. For example: `E2QWRUHAPOMQZL`. | +| [cloudfront\_distribution\_hosted\_zone\_id](#output\_cloudfront\_distribution\_hosted\_zone\_id) | The CloudFront Route 53 zone ID that can be used to route an Alias Resource Record Set to. This attribute is simply an alias for the zone ID `Z2FDTNDATAQYW2`. | +| [cloudfront\_distribution\_id](#output\_cloudfront\_distribution\_id) | The identifier for the distribution. For example: `EDFDVBD632BHDS5`. | | [cloudfront\_distribution\_in\_progress\_validation\_batches](#output\_cloudfront\_distribution\_in\_progress\_validation\_batches) | The number of invalidation batches currently in progress. | | [cloudfront\_distribution\_last\_modified\_time](#output\_cloudfront\_distribution\_last\_modified\_time) | The date and time the distribution was last modified. | | [cloudfront\_distribution\_status](#output\_cloudfront\_distribution\_status) | The current status of the distribution. Deployed if the distribution's information is fully propagated throughout the Amazon CloudFront system. | -| [cloudfront\_distribution\_tags\_all](#output\_cloudfront\_distribution\_tags\_all) | A map of tags assigned to the resource, including those inherited from the provider default\_tags configuration block. | +| [cloudfront\_distribution\_tags\_all](#output\_cloudfront\_distribution\_tags\_all) | A map of tags assigned to the resource, including those inherited from the provider `default\_tags` configuration block. | | [cloudfront\_distribution\_trusted\_key\_groups](#output\_cloudfront\_distribution\_trusted\_key\_groups) | List of nested attributes for active trusted key groups, if the distribution is set up to serve private content with signed URLs | | [cloudfront\_distribution\_trusted\_signers](#output\_cloudfront\_distribution\_trusted\_signers) | List of nested attributes for active trusted signers, if the distribution is set up to serve private content with signed URLs | | [cloudfront\_origin\_access\_identity\_caller\_reference](#output\_cloudfront\_origin\_access\_identity\_caller\_reference) | Internal value used by CloudFront to allow future updates to the origin access identity. | | [cloudfront\_origin\_access\_identity\_cloudfront\_access\_identity\_path](#output\_cloudfront\_origin\_access\_identity\_cloudfront\_access\_identity\_path) | A shortcut to the full path for the origin access identity to use in CloudFront, see below. | -| [cloudfront\_origin\_access\_identity\_etag](#output\_cloudfront\_origin\_access\_identity\_etag) | The current version of the origin access identity's information. For example: E2QWRUHAPOMQZL. | +| [cloudfront\_origin\_access\_identity\_etag](#output\_cloudfront\_origin\_access\_identity\_etag) | The current version of the origin access identity's information. For example: `E2QWRUHAPOMQZL`. | | [cloudfront\_origin\_access\_identity\_iam\_arn](#output\_cloudfront\_origin\_access\_identity\_iam\_arn) | A pre-generated ARN for use in S3 bucket policies (see below). Example: arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E2QWRUHAPOMQZL. | -| [cloudfront\_origin\_access\_identity\_id](#output\_cloudfront\_origin\_access\_identity\_id) | The identifier for the distribution. For example: EDFDVBD632BHDS5. | +| [cloudfront\_origin\_access\_identity\_id](#output\_cloudfront\_origin\_access\_identity\_id) | The identifier for the distribution. For example: `EDFDVBD632BHDS5`. | | [cloudfront\_origin\_access\_identity\_s3\_canonical\_user\_id](#output\_cloudfront\_origin\_access\_identity\_s3\_canonical\_user\_id) | The Amazon S3 canonical user ID for the origin access identity, which you use when giving the origin access identity read permission to an object in Amazon S3. | | [route53\_acm\_certificate\_validation\_records](#output\_route53\_acm\_certificate\_validation\_records) | Route 53 validation records for the ACM certificate. | | [route53\_root\_a\_record\_name](#output\_route53\_root\_a\_record\_name) | The name of the root A record. | -| [route53\_root\_www\_record\_name](#output\_route53\_root\_www\_record\_name) | The name of the www A record. | +| [route53\_root\_www\_record\_name](#output\_route53\_root\_www\_record\_name) | The name of the `www` A record. | | [s3\_bucket\_access\_policy](#output\_s3\_bucket\_access\_policy) | Bucket policy to allow CloudFront to access the S3 bucket. | | [s3\_bucket\_access\_policy\_json](#output\_s3\_bucket\_access\_policy\_json) | JSON bucket policy to allow CloudFront to access the S3 bucket. | | [s3\_bucket\_acl](#output\_s3\_bucket\_acl) | The ACL of the bucket. | -| [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | The ARN of the bucket. Will be of format arn:aws:s3:::bucketname. | +| [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | The ARN of the bucket. Will be of format `arn:aws:s3:::bucketname`. | | [s3\_bucket\_id](#output\_s3\_bucket\_id) | The name of the bucket. | | [s3\_bucket\_region](#output\_s3\_bucket\_region) | The AWS region this bucket resides in. | | [s3\_bucket\_versioning](#output\_s3\_bucket\_versioning) | The bucket versioning status. | @@ -176,14 +175,14 @@ Please use the issue tracker to report any bugs or file feature requests. Developing If you are interested in being a contributor and want to get involved in developing this project or help out with our other projects, we would love to hear from you! Shoot us an email. -In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. +In general, PRs are welcome. We follow the typical **"fork-and-pull"** Git workflow. Fork the repo on GitHub Clone the project to your own machine Commit changes to your own branch Push your work back up to your fork Submit a Pull Request so that we can review your changes -NOTE: Be sure to merge the latest changes from "upstream" before making a pull request! +NOTE: Be sure to merge the latest changes from **"upstream"** before making a pull request! ## To Do @@ -197,17 +196,17 @@ Please use the [issue tracker](https://github.com/DevOpsNavy/s3-cloudfront-stati ### Developing -If you are interested in being a contributor and want to get involved in developing this project or with our other projects, we would love to hear from you! Shoot us an [email][Admin@devopsnavy.co.uk]. +If you are interested in being a contributor and want to get involved in developing this project or with our other projects, we would love to hear from you! Shoot us an [email](mailto:Admin@devopsnavy.co.uk). -In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. +In general, PRs are welcome. We follow the typical **"fork-and-pull"** Git workflow. - 1. **Fork** the repo on GitHub + 1. [**Fork**](https://github.com/InterweaveCloud/terraform-aws-s3-cloudfront-static-website/fork) the repo on GitHub 2. **Clone** the project to your own machine 3. **Commit** changes to your own branch 4. **Push** your work back up to your fork 5. Submit a **Pull Request** so that we can review your changes -**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request! +**NOTE:** Be sure to merge the latest changes from **"upstream"** before making a pull request! ## Contributors