Skip to content

Commit cb30195

Browse files
committed
updating s3 resources
1 parent 1a07736 commit cb30195

File tree

2 files changed

+54
-17
lines changed

2 files changed

+54
-17
lines changed

.gitignore

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# Mac OS Files
2-
.DS_Store
3-
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
42
# Local .terraform directories
53
**/.terraform/*
4+
**/.terraform.lock.hcl
65

76
# .tfstate files
87
*.tfstate
@@ -24,9 +23,35 @@ override.tf.json
2423
*_override.tf
2524
*_override.tf.json
2625

27-
# Include override files you do wish to add to version control using negated pattern
28-
#
29-
# !example_override.tf
26+
# IDE Files
27+
.vscode/
28+
29+
# Mac OS files
30+
.DS_Store
31+
.AppleDouble
32+
.LSOverride
33+
*.zip
34+
Desktop.ini
35+
36+
# Icon must end with two \r
37+
Icon
38+
39+
# Files that might appear in the root of a volume
40+
.DocumentRevisions-V100
41+
.fseventsd
42+
.Spotlight-V100
43+
.TemporaryItems
44+
.Trashes
45+
.VolumeIcon.icns
46+
.com.apple.timemachine.donotpresent
47+
48+
# Directories potentially created on remote AFP share
49+
.AppleDB
50+
.AppleDesktop
51+
Network Trash Folder
52+
Temporary Items
53+
.apdisk
3054

31-
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
32-
# example: *tfplan*
55+
# Thumbnail cache files
56+
._*
57+
Thumbs.db

main.tf

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,25 @@ data "aws_caller_identity" "current" {}
1919

2020
resource "aws_s3_bucket" "this" {
2121
bucket = "${var.source_zone_name}-redirect"
22-
force_destroy = false
23-
acl = "private"
22+
force_destroy = true
23+
}
2424

25-
website {
26-
error_document = "error.html"
27-
index_document = "index.html"
25+
resource "aws_s3_bucket_acl" "this" {
26+
bucket = aws_s3_bucket.this.id
27+
acl = "private"
28+
}
29+
30+
resource "aws_s3_bucket_website_configuration" "this" {
31+
bucket = aws_s3_bucket.this.id
32+
33+
index_document {
34+
suffix = "index.html"
35+
}
36+
37+
error_document {
38+
key = "error.html"
2839
}
40+
2941
}
3042

3143
data "aws_iam_policy_document" "s3_this" {
@@ -82,10 +94,10 @@ resource "aws_cloudfront_function" "this" {
8294
runtime = "cloudfront-js-1.0"
8395
comment = var.description
8496
publish = true
85-
code = templatefile("${path.module}/src/index.js.tpl", {
86-
REDIRECT_URL = var.redirect_url,
87-
REDIRECT_HTTP_CODE = var.redirect_http_code,
88-
})
97+
code = templatefile("${path.module}/src/index.js.tpl", {
98+
REDIRECT_URL = var.redirect_url,
99+
REDIRECT_HTTP_CODE = var.redirect_http_code,
100+
})
89101
}
90102

91103
resource "aws_cloudfront_distribution" "this" {

0 commit comments

Comments
 (0)