Repository navigation
Expand file tree
/
Copy paths3.tf
More file actions
50 lines (41 loc) · 1.48 KB
/
Copy paths3.tf
File metadata and controls
50 lines (41 loc) · 1.48 KB
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
resource "aws_s3_bucket" "root_storage" {
bucket = "${var.prefix}-databricks-root-storage"
force_destroy = true
}
resource "aws_s3_bucket_server_side_encryption_configuration" "root_storage_bucket" {
bucket = aws_s3_bucket.root_storage.bucket
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
resource "aws_s3_bucket_versioning" "root_storage" {
bucket = aws_s3_bucket.root_storage.id
versioning_configuration {
status = "Disabled" # Databricks doesn't require versioning on this bucket
}
}
resource "aws_s3_bucket_public_access_block" "root_storage" {
bucket = aws_s3_bucket.root_storage.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
depends_on = [aws_s3_bucket.root_storage]
}
data "databricks_aws_bucket_policy" "this" {
provider = databricks.mws
bucket = aws_s3_bucket.root_storage.bucket
}
resource "aws_s3_bucket_policy" "root_bucket_policy" {
bucket = aws_s3_bucket.root_storage.id
policy = data.databricks_aws_bucket_policy.this.json
depends_on = [aws_s3_bucket_public_access_block.root_storage]
}
resource "databricks_mws_storage_configurations" "this" {
provider = databricks.mws
account_id = var.databricks_account_id
bucket_name = aws_s3_bucket.root_storage.bucket
storage_configuration_name = "${var.prefix}-storage"
}