-
Notifications
You must be signed in to change notification settings - Fork 0
/
s3.tf
33 lines (27 loc) · 760 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
# MWAA S3
resource "random_id" "id" {
byte_length = 2
}
resource "aws_s3_bucket" "s3_bucket" {
bucket = "${var.prefix}-${random_id.id.hex}"
versioning {
enabled = true
}
tags = merge(local.tags, {
Name = "${var.prefix}-s3-bucket"
})
}
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}")
}