Skip to content

Commit

Permalink
fast app
Browse files Browse the repository at this point in the history
  • Loading branch information
mgyucht committed Dec 12, 2024
1 parent 9114ea1 commit 52e975c
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 48 deletions.
27 changes: 26 additions & 1 deletion internal/providers/pluginfw/products/app/data_app_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,38 @@ import (
"github.com/databricks/terraform-provider-databricks/internal/acceptance"
)

const fastApp = `
resource "databricks_secret_scope" "this" {
name = "tf-{var.STICKY_RANDOM}"
}
resource "databricks_secret" "this" {
scope = databricks_secret_scope.this.name
key = "tf-{var.STICKY_RANDOM}"
string_value = "secret"
}
resource "databricks_app" "this" {
name = "{var.STICKY_RANDOM}"
description = "%s"
resources = [{
name = "secret"
description = "secret for app"
secret = {
scope = databricks_secret_scope.this.name
key = databricks_secret.this.key
permission = "MANAGE"
}
}]
}`

func TestAccAppDataSource(t *testing.T) {
acceptance.LoadWorkspaceEnv(t)
if acceptance.IsGcp(t) {
acceptance.Skipf(t)("not available on GCP")
}
acceptance.WorkspaceLevel(t, acceptance.Step{
Template: makeTemplate("My app") + `
Template: fastApp + `
data "databricks_app" "this" {
name = databricks_app.this.name
}
Expand Down
94 changes: 47 additions & 47 deletions internal/providers/pluginfw/products/app/resource_app_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,35 @@ const baseResources = `
string_value = "secret"
}
#resource "databricks_sql_endpoint" "this" {
# name = "tf-{var.STICKY_RANDOM}"
# cluster_size = "2X-Small"
# max_num_clusters = 1
resource "databricks_sql_endpoint" "this" {
name = "tf-{var.STICKY_RANDOM}"
cluster_size = "2X-Small"
max_num_clusters = 1
# tags {
# custom_tags {
# key = "Owner"
# value = "eng-dev-ecosystem-team_at_databricks.com"
# }
# }
#}
tags {
custom_tags {
key = "Owner"
value = "eng-dev-ecosystem-team_at_databricks.com"
}
}
}
#resource "databricks_job" "this" {
# name = "tf-{var.STICKY_RANDOM}"
#}
resource "databricks_job" "this" {
name = "tf-{var.STICKY_RANDOM}"
}
#resource "databricks_model_serving" "this" {
# name = "tf-{var.STICKY_RANDOM}"
# config {
# served_models {
# name = "prod_model"
# model_name = "experiment-fixture-model"
# model_version = "1"
# workload_size = "Small"
# scale_to_zero_enabled = true
# }
# }
#}
resource "databricks_model_serving" "this" {
name = "tf-{var.STICKY_RANDOM}"
config {
served_models {
name = "prod_model"
model_name = "experiment-fixture-model"
model_version = "1"
workload_size = "Small"
scale_to_zero_enabled = true
}
}
}
`

func makeTemplate(description string) string {
Expand All @@ -63,27 +63,27 @@ func makeTemplate(description string) string {
key = databricks_secret.this.key
permission = "MANAGE"
}
# }, {
# name = "warehouse"
# description = "warehouse for app"
# job = {
# id = databricks_job.this.id
# permission = "CAN_MANAGE"
# }
# }, {
# name = "serving endpoint"
# description = "serving endpoint for app"
# serving_endpoint = {
# name = databricks_model_serving.this.name
# permission = "CAN_MANAGE"
# }
# }, {
# name = "sql warehouse"
# description = "sql warehouse for app"
# sql_warehouse = {
# id = databricks_sql_endpoint.this.id
# permission = "CAN_MANAGE"
# }
}, {
name = "warehouse"
description = "warehouse for app"
job = {
id = databricks_job.this.id
permission = "CAN_MANAGE"
}
}, {
name = "serving endpoint"
description = "serving endpoint for app"
serving_endpoint = {
name = databricks_model_serving.this.name
permission = "CAN_MANAGE"
}
}, {
name = "sql warehouse"
description = "sql warehouse for app"
sql_warehouse = {
id = databricks_sql_endpoint.this.id
permission = "CAN_MANAGE"
}
}]
}`
return fmt.Sprintf(appTemplate, description)
Expand Down

0 comments on commit 52e975c

Please sign in to comment.