GithubHelp home page GithubHelp logo

cn-terraform / terraform-aws-s3-static-website Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 33.0 118 KB

Terraform Module for AWS to host Static Website on S3

Home Page: https://registry.terraform.io/modules/cn-terraform/s3-static-website/aws

License: Apache License 2.0

HCL 100.00%
aws cloud s3 static-website terraform terraform-module

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

Contributors

8888 avatar bendubuisson avatar dmurvihill avatar hjgreen avatar jatimmers avatar jnonino avatar josmo avatar liamoneill avatar mchr3k avatar mfcaro avatar neddage avatar renovate[bot] avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

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

Error putting S3 policy: MalformedPolicy: Missing required field Principal cannot be empty!

Getting this error trying to create a static web site.

Error: Error putting S3 policy: MalformedPolicy: Missing required field Principal cannot be empty!
 	status code: 400, request id: [redacted], host id: [redacted]
 
   with module.mainsite.module.main_static_site.module.s3_logs_bucket.aws_s3_bucket_policy.logs_access_policy,
   on .terraform/modules/mainsite.main_static_site.s3_logs_bucket/main.tf line 70, in resource "aws_s3_bucket_policy" "logs_access_policy":
   70: resource "aws_s3_bucket_policy" "logs_access_policy" {

This is the terraform code taht produces this issue:

module "main_static_site" {
  source  = "cn-terraform/s3-static-website/aws"
  version = "0.0.17"
  name_prefix=var.deployment_name
  website_domain_name=var.main_site_domain_name
  create_route53_hosted_zone = false
  route53_hosted_zone_id = aws_route53_zone.main.zone_id
  providers = {
    aws.main = aws
    aws.acm_provider = aws
  }
}

Where the following applies:
* var.main_deployment_name = "production"
* var.main_site_domain_name = "mydomain.com"

I'm creating a hosted zone manually and passing it in.

The line in the associated module shows this on line 70:

```hcl
resource "aws_s3_bucket_policy" "logs_access_policy" {
  bucket = aws_s3_bucket.logs.id
  policy = data.aws_iam_policy_document.logs_access_policy_document.json
}

I'm not sure which field is missing, but this is the result from AWS. Is there a known workaround for this?

Fix issues in the module

  • Remove transfer acceleration parameter as S3 Transfer Acceleration is not supported for buckets with periods (.) in their names
  • Log bucket is not referenced properly in CloudFront resources.

Deprecated attribute - website_endpoint

I get the following warning when using this module:

│ Warning: Deprecated attribute
│
│   on .terraform/modules/eu-west-1.frontend.website/outputs.tf line 41, in output "website_bucket_website_endpoint":
│   41:   value       = aws_s3_bucket.website.website_endpoint
│
│ The attribute "website_endpoint" is deprecated. Refer to the provider documentation for details.

This change is required as part of the V4.0 AWS provider upgrade: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-4-upgrade#website-website_domain-and-website_endpoint-arguments

Unable to use custom ACM certificate

I have been trying to use this module to host static website from S3 bucket. I'm unable to use custom ACM certificate when create_acm_certificate is set to false and acm_certificate_arn_to_use is used.

I always get the below error,

╷
│ Error: Invalid index
│ 
│   on main.tf line 74, in resource "aws_route53_record" "acm_certificate_validation_records":
│   74:     for dvo in aws_acm_certificate.cert[0].domain_validation_options : dvo.domain_name => {
│     ├────────────────
│     │ aws_acm_certificate.cert is empty tuple
│ 
│ The given key does not identify an element in this collection value: the
│ collection has no elements.

Any leads to this could be helpful.

Error: Variables not allowed

When attempting to

module "s3-static-website" {
  source                        = "cn-terraform/s3-static-website/aws"
  version                       = "1.0.3"
  name_prefix                            = "some-prefix"
  website_domain_name           = "some.url.com"
  cloudfront_enable_compression = true
  website_bucket_acl            = "public-read"
  create_acm_certificate        = true
  create_route53_hosted_zone    = true
}

I receive the error:

Error: Variables not allowed

On .tf\modules\s3-static-website\versions.tf line 7: Variables may not be used
here.

versions.tf is having issues with the configuration_aliases line:

terraform {
  required_version = ">= 0.13"
  required_providers {
    aws = {
      source                = "hashicorp/aws"
      version               = ">= 4.0"
      configuration_aliases = [aws.main, aws.acm_provider]
    }
  }
}

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/pipeline.yml
  • actions/checkout v4
  • actions/checkout v4
terraform
main.tf
  • cn-terraform/logs-s3-bucket/aws 1.0.6
versions.tf
  • aws >= 4.0
  • hashicorp/terraform >= 0.13

  • Check this box to trigger a request for Renovate to run again on this repository

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.