Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DAT-18567] DevOps :: liquibase-databricks terraform fails to recreate IT tests schema #180

Merged
merged 4 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/lth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ jobs:
- run: terraform plan
working-directory: src/test/terraform

- run: terraform apply -auto-approve
- run: |
terraform import databricks_schema.test_harness main.liquibase_harness_test_ds || true
terraform taint databricks_schema.test_harness || true
terraform apply -auto-approve
working-directory: src/test/terraform

- name: Collect Databricks Config
Expand Down
2 changes: 1 addition & 1 deletion src/test/terraform/auth.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "DBX_HOST" {
}

variable "DBX_TOKEN" {
type = string
type = string
}

# Initialize the Databricks Terraform provider.
Expand Down
12 changes: 10 additions & 2 deletions src/test/terraform/dbsql_endpoint.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
resource "random_string" "suffix" {
length = 8
special = false
upper = false
}
resource "databricks_sql_endpoint" "this" {
name = "Databricks Liquibase Test Harness Endpoint"
name = "Databricks Liquibase Test Harness Endpoint-${random_string.suffix.result}"
cluster_size = "Small"
max_num_clusters = 1
warehouse_type = "PRO"
warehouse_type = "PRO"
lifecycle {
create_before_destroy = true
}
}

output "endpoint_url" {
Expand Down
4 changes: 2 additions & 2 deletions src/test/terraform/schema.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
TF_VAR_TEST_CATALOG = "main"
TF_VAR_TEST_SCHEMA = "liquibase_harness_test_ds"
TF_VAR_TEST_CATALOG = "main"
TF_VAR_TEST_SCHEMA = "liquibase_harness_test_ds"
schema_force_destroy = true
16 changes: 8 additions & 8 deletions src/test/terraform/schema.tf
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
variable "TF_VAR_TEST_SCHEMA" {
description = "Name of Liquibase test harness database"
type = string
default = "liquibase_harness_test_ds"
type = string
default = "liquibase_harness_test_ds"
}


variable "TF_VAR_TEST_CATALOG" {
description = "Catalog of liquibase testing database"
type = string
default = "main"
type = string
default = "main"
}

variable "schema_force_destroy" {
type = bool
type = bool
default = true
}

resource "databricks_schema" "test_harness" {
catalog_name = var.TF_VAR_TEST_CATALOG
name = var.TF_VAR_TEST_SCHEMA
comment = "This database is for liquibase test harness"
catalog_name = var.TF_VAR_TEST_CATALOG
name = var.TF_VAR_TEST_SCHEMA
comment = "This database is for liquibase test harness"
force_destroy = var.schema_force_destroy
properties = {
purpose = "testing"
Expand Down
Loading