-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3.tf
43 lines (35 loc) · 1.04 KB
/
s3.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
resource "random_pet" "this" {
length = 1
}
module "website_bucket" {
source = "terraform-aws-modules/s3-bucket/aws"
version = "3.6.0"
bucket = "${var.domain}-${random_pet.this.id}"
force_destroy = true
restrict_public_buckets = true
ignore_public_acls = true
block_public_acls = true
block_public_policy = true
object_ownership = "BucketOwnerEnforced"
control_object_ownership = true
versioning = {
enabled = true
}
website = {
index_document = "index.html"
error_document = "error.html"
routing_rules = [{
redirect = {
host_name = module.route53_http_redirect_target_url.hostname
http_redirect_code = 301
protocol = module.route53_http_redirect_target_url.protocol
replace_key_with = module.route53_http_redirect_target_url.path_and_param
}
}]
}
}
module "route53_http_redirect_target_url" {
source = "TechNative-B-V/url-parser/null"
version = "0.1.1"
url = var.redirect_target_url
}