Skip to content

Commit

Permalink
Merge pull request #19 from fillup/develop
Browse files Browse the repository at this point in the history
Release 6.0.0 - update to AWS provider version 4
  • Loading branch information
briskt authored May 15, 2023
2 parents e03a13c + e3dc1c9 commit 8efd94c
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, < 5"
source = "hashicorp/aws"
}
}
}

0 comments on commit 8efd94c

Please sign in to comment.