Skip to content

Commit

Permalink
Merge pull request #18 from briskt/feature/remove-s3-deprecated
Browse files Browse the repository at this point in the history
remove s3 deprecated arguments
  • Loading branch information
briskt authored May 12, 2023
2 parents 5c809cb + 1da194c commit 271e7a9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
30 changes: 23 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,34 @@ data "template_file" "bucket_policy" {

resource "aws_s3_bucket" "hugo" {
bucket = var.bucket_name
acl = "public-read"
policy = data.template_file.bucket_policy.rendered
force_destroy = true
}

resource "aws_s3_bucket_acl" "hugo" {
bucket = aws_s3_bucket.hugo.id
acl = "public-read"
}

website {
index_document = var.index_document
error_document = "${var.origin_path}/${var.error_document}"
resource "aws_s3_bucket_policy" "hugo" {
bucket = aws_s3_bucket.hugo.id
policy = data.template_file.bucket_policy.rendered
}

// Routing rule is needed to support hugo friendly urls
routing_rules = var.routing_rules
resource "aws_s3_bucket_website_configuration" "hugo" {
bucket = aws_s3_bucket.hugo.id
index_document {
suffix = var.index_document
}
error_document {
key = "${var.origin_path}/${var.error_document}"
}

// Routing rule is needed to support hugo friendly urls
routing_rules = var.routing_rules
}

resource "aws_s3_bucket_cors_configuration" "hugo" {
bucket = aws_s3_bucket.hugo.id
cors_rule {
allowed_headers = var.cors_allowed_headers
allowed_methods = var.cors_allowed_methods
Expand Down
7 changes: 7 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@

terraform {
required_version = ">= 0.12"

required_providers {
aws = {
version = ">= 4.0"
source = "hashicorp/aws"
}
}
}

0 comments on commit 271e7a9

Please sign in to comment.