-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathworkspace.tf
57 lines (45 loc) · 1.82 KB
/
workspace.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
resource "databricks_mws_networks" "this" {
account_id = var.databricks_account_id
network_name = "${local.prefix}-network"
security_group_ids = [aws_security_group.default_spoke_sg.id]
subnet_ids = aws_subnet.spoke_db_private_subnet[*].id
vpc_id = aws_vpc.spoke_vpc.id
dynamic "vpc_endpoints" {
for_each = var.enable_private_link ? [1] : []
content {
dataplane_relay = databricks_mws_vpc_endpoint.relay_vpce[*].vpc_endpoint_id
rest_api = databricks_mws_vpc_endpoint.backend_rest_vpce[*].vpc_endpoint_id
}
}
}
resource "databricks_mws_storage_configurations" "this" {
account_id = var.databricks_account_id
bucket_name = aws_s3_bucket.root_storage_bucket.bucket
storage_configuration_name = "${local.prefix}-storage"
}
## Adding 20 second timer to avoid Failed credential validation check
resource "time_sleep" "wait" {
create_duration = "20s"
depends_on = [
aws_iam_role_policy.cross_account_policy
]
}
resource "databricks_mws_credentials" "this" {
account_id = var.databricks_account_id
role_arn = aws_iam_role.cross_account_role.arn
credentials_name = "${local.prefix}-creds"
depends_on = [time_sleep.wait]
}
resource "databricks_mws_workspaces" "this" {
account_id = var.databricks_account_id
aws_region = var.region
workspace_name = local.prefix
credentials_id = databricks_mws_credentials.this.credentials_id
storage_configuration_id = databricks_mws_storage_configurations.this.storage_configuration_id
network_id = databricks_mws_networks.this.network_id
private_access_settings_id = databricks_mws_private_access_settings.pla.private_access_settings_id
is_no_public_ip_enabled = true
token {
comment = "Terraform token"
}
}