-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
78 lines (65 loc) · 1.32 KB
/
main.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
terraform {
backend "s3" {
profile = "arbeiter"
bucket = "intense-tfstates"
key = "usairnetmap"
region = "us-east-1"
}
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.27"
}
}
}
provider "aws" {
profile = "arbeiter"
region = "us-east-1"
}
resource "aws_s3_bucket" "usairnetmap" {
bucket = "usairnetmap.com"
acl = "public-read"
website {
index_document = "index.html"
error_document = "error.html"
}
}
resource "aws_s3_bucket_policy" "usairnetmap" {
bucket = aws_s3_bucket.usairnetmap.id
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"${aws_s3_bucket.usairnetmap.arn}/*",
]
}
]
})
}
resource "aws_iam_user" "usairnetmap" {
name = "usairnetmap"
}
resource "aws_iam_user_policy" "usairnetmap" {
name = "usairnetmap"
user = aws_iam_user.usairnetmap.name
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
],
"Resource": "arn:aws:s3:::usairnetmap.com/*",
},
]
})
}
# vim: ts=2 expandtab