-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
executable file
·35 lines (31 loc) · 1.27 KB
/
main.tf
File metadata and controls
executable file
·35 lines (31 loc) · 1.27 KB
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
data "aws_iam_policy_document" "bucket_policy" {
statement {
sid = "PublicReadGetObject"
effect = "Allow"
actions = [ "s3:GetObject" ]
principals {
type = "*"
identifiers = [ "*" ]
}
resources = [ "arn:aws:s3:::vespuccibucketterra.org/*" ]
}
}
/* We can access properties from data sources using this format:
${data.<data_source_type>.<data_source_name>.<property>.
In this case, we need the JSON document, which the documentation
says can be accessed from the .json property. */
resource "aws_s3_bucket" "jesuisfatiguer" {
bucket = "vespuccibucketterra.org" // The name of the bucket.
acl = "public-read" /* Access control list for the bucket.
Websites need to be publicly-available
to the Internet for website hosting to
work. */
policy = "${data.aws_iam_policy_document.bucket_policy.json}"
website {
index_document = "index.htm" // The root of the website.
error_document = "error.htm" // The page to show when people hit invalid pages.
}
}
output "jesuisfatiguer_bucket_url" {
value = "${aws_s3_bucket.jesuisfatiguer.website_endpoint}" #url to access the website on the internet
}