-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy paths3.tf
137 lines (119 loc) · 2.61 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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
resource "aws_vpc_endpoint" "log_archive" {
vpc_id = aws_vpc.opsvpc.id
route_table_ids = [aws_route_table.ops_route_table.id]
service_name = "com.amazonaws.eu-west-2.s3"
}
resource "aws_s3_bucket" "ops_config_bucket" {
bucket = var.ops_config_bucket
acl = var.ops_config_acl
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
versioning {
enabled = true
}
logging {
target_bucket = var.log_archive_s3_bucket
target_prefix = "ops_config_bucket/"
}
lifecycle_rule {
enabled = true
transition {
days = 0
storage_class = "INTELLIGENT_TIERING"
}
noncurrent_version_transition {
days = 0
storage_class = "INTELLIGENT_TIERING"
}
noncurrent_version_expiration {
days = 1
}
}
tags = {
Name = "ops_config_bucket-${local.naming_suffix}"
}
}
resource "aws_s3_bucket_policy" "ops_config_bucket" {
bucket = var.ops_config_bucket
policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "HTTP",
"Effect": "Deny",
"Principal": "*",
"Action": "*",
"Resource": "arn:aws:s3:::${var.ops_config_bucket}/*",
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}
]
}
POLICY
}
resource "aws_s3_bucket" "athena_maintenance_bucket" {
bucket = var.athena_maintenance_bucket
acl = var.athena_maintenance_acl
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
versioning {
enabled = true
}
logging {
target_bucket = var.log_archive_s3_bucket
target_prefix = "athena_maintenance_bucket/"
}
lifecycle_rule {
enabled = true
transition {
days = 0
storage_class = "INTELLIGENT_TIERING"
}
noncurrent_version_transition {
days = 0
storage_class = "INTELLIGENT_TIERING"
}
noncurrent_version_expiration {
days = 1
}
}
tags = {
Name = "athena_maintenance_bucket_${local.naming_suffix}"
}
}
resource "aws_s3_bucket_policy" "athena_maintenance_bucket" {
bucket = var.athena_maintenance_bucket
policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "HTTP",
"Effect": "Deny",
"Principal": "*",
"Action": "*",
"Resource": "arn:aws:s3:::${var.athena_maintenance_bucket}/*",
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}
]
}
POLICY
}