Giter Club home page Giter Club logo

terraform-aws-cloudfront-s3-website's Introduction

terraform-aws-cloudfront-s3-website

Terraform module for creating an s3 static website with Cloudfront distribution

The following resources will be created

  • S3 Bucket
  • CloudFront distribution
  • Route53 record
  • Upload sample HTML file (optional)

Prerequisites (Optional in example2):

  • Route 53 hosted zone for example.com
  • ACM certificate for *.example.com in us-east-1 region

Example 1

provider "aws" {
  region = "us-east-1"
}

module "cloudfront_s3_website_with_domain" {
    source                 = "chgangaraju/cloudfront-s3-website/aws"
    version                = "1.2.6"
    hosted_zone            = "example.com" 
    domain_name            = "test.abc.example.com"
    acm_certificate_domain = "*.abc.example.com"
    upload_sample_file     = true
}

Example 2

module "cloudfront_s3_website_without_domain" {
    source                 = "chgangaraju/cloudfront-s3-website/aws"
    version                = "1.2.6"
    domain_name            = "test-application-1232" // Any random identifier for s3 bucket name
    use_default_domain     = true
    upload_sample_file     = true
}

Cloudfront TTL settings

        # optional values
        cloudfront_min_ttl     = 10
        cloudfront_default_ttl = 1400
        cloudfront_max_ttl     = 86400

terraform-aws-cloudfront-s3-website's People

Contributors

caherrera avatar chgangaraju avatar hk1313 avatar joshuamkite avatar lyda avatar marcellodesales avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

terraform-aws-cloudfront-s3-website's Issues

Support for HTTP Response Header in Cloudfront

Problem

Proposed Solution

  • Expose a parameter for HTTP Response Headers
  • Use them to provide to the lambda service

Resources

Enable compatibility with Terraform 4.XX


│ Warning: Argument is deprecated

│ with module.website.module.cloudfront_s3_website_without_domain.aws_s3_bucket.s3_bucket,
│ on .terraform\modules\website.cloudfront_s3_website_without_domain\main.tf line 44, in resource "aws_s3_bucket" "s3_bucket":
│ 44: resource "aws_s3_bucket" "s3_bucket" {

│ Use the aws_s3_bucket_versioning resource instead

│ (and one more similar warning elsewhere)

Releasing state lock. This may take a few moments...

Warning: Interpolation-only expressions are deprecated (Terraform v0.12.18)

Hi, I get the following warnings running terraform plan and terraform apply

Warning: Quoted references are deprecated

  on .terraform/modules/website/chgangaraju-terraform-aws-cloudfront-s3-website-1c8581f/main.tf line 8, in data "aws_acm_certificate" "acm_cert":
   8:   provider = "aws.aws_cloudfront"

In this context, references are expected literally rather than in quotes.
Terraform 0.11 and earlier required quotes, but quoted references are now
deprecated and will be removed in a future version of Terraform. Remove the
quotes surrounding this reference to silence this warning.

(and 2 more similar warnings elsewhere)


Warning: Interpolation-only expressions are deprecated

  on .terraform/modules/website/chgangaraju-terraform-aws-cloudfront-s3-website-1c8581f/main.tf line 40, in resource "aws_s3_bucket" "s3_bucket":
  40:   bucket = "${var.domain_name}"

Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.

Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.

(and 9 more similar warnings elsewhere)


Warning: Quoted type constraints are deprecated

  on .terraform/modules/website/chgangaraju-terraform-aws-cloudfront-s3-website-1c8581f/variables.tf line 5, in variable "tags":
   5:   type    = "map"

Terraform 0.11 and earlier required type constraints to be given in quotes,
but that form is now deprecated and will be removed in a future version of
Terraform. To silence this warning, remove the quotes around "map" and write
map(string) instead to explicitly indicate that the map elements are strings.

I am using the current terraform version:

> terraform --version
Terraform v0.12.18
+ provider.aws v2.43.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.