Terraform module for S3 static website hosting

module “s3_website_bucket” {
source = “terraform-aws-modules/s3-bucket/aws”
bucket = “test.dev.net”
acl = “public-read”
control_object_ownership = true
object_ownership = “Buck…


This content originally appeared on DEV Community and was authored by leroykayanda

module "s3_website_bucket" {
  source                   = "terraform-aws-modules/s3-bucket/aws"
  bucket                   = "test.dev.net"
  acl                      = "public-read"
  control_object_ownership = true
  object_ownership         = "BucketOwnerPreferred"
  force_destroy            = false
  block_public_acls        = false
  block_public_policy      = false
  ignore_public_acls       = false
  restrict_public_buckets  = false
  tags                     = var.tags[var.world]

  website = {
    index_document = "index.html"
    error_document = "error.html"
  }

  # Allow public read access
  attach_policy = true
  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Sid       = "PublicReadGetObject"
        Effect    = "Allow"
        Principal = "*"
        Action    = "s3:GetObject"
        Resource  = "arn:aws:s3:::test.dev.net/*"
      },
    ]
  })

}


This content originally appeared on DEV Community and was authored by leroykayanda


Print Share Comment Cite Upload Translate Updates
APA

leroykayanda | Sciencx (2024-09-20T17:52:05+00:00) Terraform module for S3 static website hosting. Retrieved from https://www.scien.cx/2024/09/20/terraform-module-for-s3-static-website-hosting/

MLA
" » Terraform module for S3 static website hosting." leroykayanda | Sciencx - Friday September 20, 2024, https://www.scien.cx/2024/09/20/terraform-module-for-s3-static-website-hosting/
HARVARD
leroykayanda | Sciencx Friday September 20, 2024 » Terraform module for S3 static website hosting., viewed ,<https://www.scien.cx/2024/09/20/terraform-module-for-s3-static-website-hosting/>
VANCOUVER
leroykayanda | Sciencx - » Terraform module for S3 static website hosting. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/20/terraform-module-for-s3-static-website-hosting/
CHICAGO
" » Terraform module for S3 static website hosting." leroykayanda | Sciencx - Accessed . https://www.scien.cx/2024/09/20/terraform-module-for-s3-static-website-hosting/
IEEE
" » Terraform module for S3 static website hosting." leroykayanda | Sciencx [Online]. Available: https://www.scien.cx/2024/09/20/terraform-module-for-s3-static-website-hosting/. [Accessed: ]
rf:citation
» Terraform module for S3 static website hosting | leroykayanda | Sciencx | https://www.scien.cx/2024/09/20/terraform-module-for-s3-static-website-hosting/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.