Skip to content

Commit b937c19

Browse files
authored
[Internal] switch TestMwsAccWorkspacesTokenUpdate to BYOVPC (#4525)
## Changes - `TestMwsAccWorkspacesTokenUpdate` is using Databricks-managed VPC, which cannot be cleaned up if workspace creation failed. ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [x] covered with integration tests in `internal/acceptance` NO_CHANGELOG=true
1 parent 3004cb9 commit b937c19

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

mws/mws_workspaces_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,24 @@ func TestMwsAccWorkspacesTokenUpdate(t *testing.T) {
9797
storage_configuration_name = "storage-ws-{var.RANDOM}"
9898
bucket_name = "{env.TEST_ROOT_BUCKET}"
9999
}
100+
resource "databricks_mws_networks" "this" {
101+
account_id = "{env.DATABRICKS_ACCOUNT_ID}"
102+
network_name = "network-ws-{var.RANDOM}"
103+
vpc_id = "{env.TEST_VPC_ID}"
104+
subnet_ids = [
105+
"{env.TEST_SUBNET_PRIVATE}",
106+
"{env.TEST_SUBNET_PRIVATE2}",
107+
]
108+
security_group_ids = [
109+
"{env.TEST_SECURITY_GROUP}",
110+
]
111+
}
100112
resource "databricks_mws_workspaces" "this" {
101113
account_id = "{env.DATABRICKS_ACCOUNT_ID}"
102114
workspace_name = "terra-{var.RANDOM}"
103115
aws_region = "{env.AWS_REGION}"
104116
117+
network_id = databricks_mws_networks.this.network_id
105118
credentials_id = databricks_mws_credentials.this.credentials_id
106119
storage_configuration_id = databricks_mws_storage_configurations.this.storage_configuration_id
107120
managed_services_customer_managed_key_id = databricks_mws_customer_managed_keys.this.customer_managed_key_id
@@ -157,11 +170,24 @@ func TestMwsAccWorkspacesTokenUpdate(t *testing.T) {
157170
storage_configuration_name = "storage-ws-{var.RANDOM}"
158171
bucket_name = "{env.TEST_ROOT_BUCKET}"
159172
}
173+
resource "databricks_mws_networks" "this" {
174+
account_id = "{env.DATABRICKS_ACCOUNT_ID}"
175+
network_name = "network-ws-{var.RANDOM}"
176+
vpc_id = "{env.TEST_VPC_ID}"
177+
subnet_ids = [
178+
"{env.TEST_SUBNET_PRIVATE}",
179+
"{env.TEST_SUBNET_PRIVATE2}",
180+
]
181+
security_group_ids = [
182+
"{env.TEST_SECURITY_GROUP}",
183+
]
184+
}
160185
resource "databricks_mws_workspaces" "this" {
161186
account_id = "{env.DATABRICKS_ACCOUNT_ID}"
162187
workspace_name = "terra-{var.RANDOM}"
163188
aws_region = "{env.AWS_REGION}"
164189
190+
network_id = databricks_mws_networks.this.network_id
165191
credentials_id = databricks_mws_credentials.this.credentials_id
166192
storage_configuration_id = databricks_mws_storage_configurations.this.storage_configuration_id
167193
managed_services_customer_managed_key_id = databricks_mws_customer_managed_keys.this.customer_managed_key_id

0 commit comments

Comments
 (0)