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

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

Awesome Lists containing this project

README

          

# terraform-aws-cloudfront

[![Build Status](https://github.com/JamesWoolfenden/terraform-aws-cloudfront/workflows/Verify/badge.svg?branch=master)](https://github.com/JamesWoolfenden/terraform-aws-cloudfront)
[![Latest Release](https://img.shields.io/github/release/JamesWoolfenden/terraform-aws-cloudfront.svg)](https://github.com/JamesWoolfenden/terraform-aws-cloudfront/releases/latest)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/JamesWoolfenden/terraform-aws-cloudfront.svg?label=latest)](https://github.com/JamesWoolfenden/terraform-aws-cloudfront/releases/latest)
![Terraform Version](https://img.shields.io/badge/tf-%3E%3D0.14.0-blue.svg)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/JamesWoolfenden/terraform-aws-cloudfront/cis_aws)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-cloudfront&benchmark=CIS+AWS+V1.2)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![checkov](https://img.shields.io/badge/checkov-verified-brightgreen)](https://www.checkov.io/)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/jameswoolfenden/terraform-aws-cloudfront/general)](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

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](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