-
Notifications
You must be signed in to change notification settings - Fork 22
/
s3.tf
37 lines (31 loc) · 824 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
# MWAA S3
resource "aws_s3_bucket" "s3_bucket" {
bucket = var.prefix
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
versioning {
enabled = true
}
tags = merge(local.tags, {
Name = var.prefix
})
}
resource "aws_s3_bucket_public_access_block" "s3_bucket_public_access_block" {
bucket = aws_s3_bucket.s3_bucket.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}
resource "aws_s3_bucket_object" "dags" {
for_each = fileset("dags/", "*.py")
bucket = aws_s3_bucket.s3_bucket.id
key = "dags/${each.value}"
source = "dags/${each.value}"
etag = filemd5("dags/${each.value}")
}