https://github.com/jameswoolfenden/terraform-aws-cloudfront
A basic module to provision cloudfront
https://github.com/jameswoolfenden/terraform-aws-cloudfront
aws cloudfront module terraform
Last synced: over 1 year ago
JSON representation
A basic module to provision cloudfront
- Host: GitHub
- URL: https://github.com/jameswoolfenden/terraform-aws-cloudfront
- Owner: JamesWoolfenden
- License: apache-2.0
- Created: 2019-10-06T16:28:41.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-26T16:04:48.000Z (about 3 years ago)
- Last Synced: 2025-01-25T19:28:05.483Z (over 1 year ago)
- Topics: aws, cloudfront, module, terraform
- Language: HCL
- Homepage:
- Size: 102 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# terraform-aws-cloudfront
[](https://github.com/JamesWoolfenden/terraform-aws-cloudfront)
[](https://github.com/JamesWoolfenden/terraform-aws-cloudfront/releases/latest)
[](https://github.com/JamesWoolfenden/terraform-aws-cloudfront/releases/latest)

[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-cloudfront&benchmark=CIS+AWS+V1.2)
[](https://github.com/pre-commit/pre-commit)
[](https://www.checkov.io/)
[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-cloudfront&benchmark=INFRASTRUCTURE+SECURITY)
Terraform module to provision infra .
---
It's 100% Open Source and licensed under the [APACHE2](LICENSE).
## Introduction
## Usage
Creates a static site with cloudfront distribution in front
## Requirements
No requirements.
## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | 4.64.0 |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_cloudfront_distribution.distribution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution) | resource |
| [aws_cloudfront_response_headers_policy.example](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_response_headers_policy) | resource |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [acm\_certificate\_arn](#input\_acm\_certificate\_arn) | n/a | `string` | n/a | yes |
| [aliases](#input\_aliases) | n/a | `list(any)` | n/a | yes |
| [cloudfront\_default\_certificate](#input\_cloudfront\_default\_certificate) | n/a | `string` | n/a | yes |
| [comment](#input\_comment) | n/a | `string` | n/a | yes |
| [content\_security\_policy](#input\_content\_security\_policy) | n/a | `map` |
{
"content_security_policy": "default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'; frame-ancestors 'none'",
"override": true
} | no |
| [content\_type\_options](#input\_content\_type\_options) | n/a | `bool` | `true` | no |
| [default\_cache](#input\_default\_cache) | n/a | `map(any)` | n/a | yes |
| [default\_root\_object](#input\_default\_root\_object) | n/a | `string` | n/a | yes |
| [distribution\_enabled](#input\_distribution\_enabled) | n/a | `bool` | `true` | no |
| [domain\_name](#input\_domain\_name) | n/a | `string` | n/a | yes |
| [frame\_options](#input\_frame\_options) | n/a | `map` | {
"frame_option": "DENY",
"override": true
} | no |
| [ipv6\_enabled](#input\_ipv6\_enabled) | n/a | `string` | n/a | yes |
| [logging\_config](#input\_logging\_config) | n/a | `map(any)` | n/a | yes |
| [logging\_include\_cookies](#input\_logging\_include\_cookies) | n/a | `string` | n/a | yes |
| [origin](#input\_origin) | n/a | `map(any)` | n/a | yes |
| [policy\_name](#input\_policy\_name) | n/a | `string` | n/a | yes |
| [price\_class](#input\_price\_class) | n/a | `string` | n/a | yes |
| [referrer\_policy](#input\_referrer\_policy) | n/a | `map` | {
"override": true,
"referrer_policy": "same-origin"
} | no |
| [restriction\_locations](#input\_restriction\_locations) | n/a | `list(any)` | n/a | yes |
| [restriction\_type](#input\_restriction\_type) | n/a | `string` | n/a | yes |
| [ssl\_support\_method](#input\_ssl\_support\_method) | n/a | `string` | n/a | yes |
| [strict\_transport\_security](#input\_strict\_transport\_security) | n/a | `map` | {
"access_control_max_age_sec": 31536000,
"include_subdomains": true,
"override": true,
"preload": true
} | no |
| [tags](#input\_tags) | n/a | `map(any)` | n/a | yes |
| [web\_acl\_id](#input\_web\_acl\_id) | n/a | `string` | n/a | yes |
| [xss\_protection](#input\_xss\_protection) | n/a | `map` | {
"mode_block": true,
"override": true,
"protection": true
} | no |
## Outputs
| Name | Description |
|------|-------------|
| [distribution](#output\_distribution) | n/a |
| [domain\_name](#output\_domain\_name) | n/a |
| [hosted\_zone\_id](#output\_hosted\_zone\_id) | n/a |
## Policy
The Terraform resource required is:
```golang
resource "aws_iam_policy" "terraform_pike" {
name_prefix = "terraform_pike"
path = "/"
description = "Pike Autogenerated policy from IAC"
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"cloudfront:CreateDistribution",
"cloudfront:DeleteDistribution",
"cloudfront:GetDistribution",
"cloudfront:ListTagsForResource",
"cloudfront:TagResource",
"cloudfront:UntagResource",
"cloudfront:UpdateDistribution"
],
"Resource": [
"*"
]
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"ec2:DescribeAccountAttributes"
],
"Resource": [
"*"
]
}
]
})
}
```
## Help
**Got a question?**
File a GitHub [issue](https://github.com/JamesWoolfenden/terraform-aws-cloudfront/issues).
## Contributing
### Bug Reports & Feature Requests
Please use the [issue tracker](https://github.com/JamesWoolfenden/terraform-aws-cloudfront/issues) to report any bugs or file feature requests.
## Copyrights
Copyright © 2018-2023 James Woolfenden
## License
[](https://opensource.org/licenses/Apache-2.0)
See [LICENSE](LICENSE) for full details.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
### Contributors
[![James Woolfenden][jameswoolfenden_avatar]][jameswoolfenden_homepage]
[James Woolfenden][jameswoolfenden_homepage]
[jameswoolfenden_homepage]: https://github.com/jameswoolfenden
[jameswoolfenden_avatar]: https://github.com/jameswoolfenden.png?size=150