-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3.tf
executable file
·57 lines (38 loc) · 1007 Bytes
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
resource "aws_s3_bucket" "blog_bucket" {
bucket = "blog-website-project.aws"
acl = "public-read"
policy = file("policy.json")
website {
index_document = "index.html"
}
}
resource "aws_s3_bucket_object" "upload_html" {
bucket = "${aws_s3_bucket.blog_bucket.id}"
key = "index.html"
acl = "public-read"
source = "assets/index.html"
etag = filemd5("assets/index.html")
}
resource "local_file" "js_file" {
content = templatefile("index.tmpl",
{
api_dns = module.api_gateway.apigatewayv2_api_api_endpoint
}
)
filename = "${path.module}/assets/index.js"
}
resource "aws_s3_bucket_object" "upload_js" {
bucket = "${aws_s3_bucket.blog_bucket.id}"
key = "index.js"
acl = "public-read"
source = "${template_file.js_file.rendered}"
depends_on = [
local_file.js_file
]
}
resource "template_file" "js_file" {
template = "${path.module}/index.tmpl"
vars = {
api_dns = module.api_gateway.apigatewayv2_api_api_endpoint
}
}