-
Notifications
You must be signed in to change notification settings - Fork 0
/
s3.tf
41 lines (31 loc) · 1.13 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
resource "aws_s3_bucket" "root_storage_bucket" {
bucket = var.root_bucket_name
force_destroy = true
tags = merge(var.default_tags, {
Name = var.root_bucket_name
})
count = var.create_root_bucket ? 1 : 0
}
resource "aws_s3_bucket_versioning" "root_storage_bucket" {
bucket = aws_s3_bucket.root_storage_bucket[0].id
versioning_configuration {
status = "Enabled"
}
count = var.create_root_bucket ? 1 : 0
}
resource "aws_s3_bucket_public_access_block" "root_storage_bucket" {
bucket = aws_s3_bucket.root_storage_bucket[0].id
ignore_public_acls = true
depends_on = [aws_s3_bucket.root_storage_bucket[0]]
count = var.create_root_bucket ? 1 : 0
}
data "databricks_aws_bucket_policy" "root_storage_bucket" {
bucket = aws_s3_bucket.root_storage_bucket[0].bucket
count = var.create_root_bucket ? 1 : 0
}
resource "aws_s3_bucket_policy" "root_bucket_policy" {
bucket = aws_s3_bucket.root_storage_bucket[0].id
policy = data.databricks_aws_bucket_policy.root_storage_bucket[0].json
depends_on = [aws_s3_bucket_public_access_block.root_storage_bucket[0]]
count = var.create_root_bucket ? 1 : 0
}