Skip to content

JamesWoolfenden/terraform-aws-cloudfront

Repository files navigation

terraform-aws-cloudfront

Build Status Latest Release GitHub tag (latest SemVer) Terraform Version Infrastructure Tests pre-commit checkov Infrastructure Tests

Terraform module to provision infra .


It's 100% Open Source and licensed under the APACHE2.

Introduction

Usage

Creates a static site with cloudfront distribution in front

Requirements

No requirements.

Providers

Name Version
aws 4.64.0

Modules

No modules.

Resources

Name Type
aws_cloudfront_distribution.distribution resource
aws_cloudfront_response_headers_policy.example resource

Inputs

Name Description Type Default Required
acm_certificate_arn n/a string n/a yes
aliases n/a list(any) n/a yes
cloudfront_default_certificate n/a string n/a yes
comment n/a string n/a yes
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 n/a bool true no
default_cache n/a map(any) n/a yes
default_root_object n/a string n/a yes
distribution_enabled n/a bool true no
domain_name n/a string n/a yes
frame_options n/a map
{
"frame_option": "DENY",
"override": true
}
no
ipv6_enabled n/a string n/a yes
logging_config n/a map(any) n/a yes
logging_include_cookies n/a string n/a yes
origin n/a map(any) n/a yes
policy_name n/a string n/a yes
price_class n/a string n/a yes
referrer_policy n/a map
{
"override": true,
"referrer_policy": "same-origin"
}
no
restriction_locations n/a list(any) n/a yes
restriction_type n/a string n/a yes
ssl_support_method n/a string n/a yes
strict_transport_security n/a map
{
"access_control_max_age_sec": 31536000,
"include_subdomains": true,
"override": true,
"preload": true
}
no
tags n/a map(any) n/a yes
web_acl_id n/a string n/a yes
xss_protection n/a map
{
"mode_block": true,
"override": true,
"protection": true
}
no

Outputs

Name Description
distribution n/a
domain_name n/a
hosted_zone_id n/a

Policy

The Terraform resource required is:

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.

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Copyrights

Copyright © 2018-2023 James Woolfenden

License

License

See 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

https://www.apache.org/licenses/LICENSE-2.0

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
James Woolfenden