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

Prepare v0.3.8 #851

Merged
merged 4 commits into from
Oct 7, 2021
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Default `terraform-mount` clusters created for mounting for `databricks_aws_s3_mount`, `databricks_azure_adls_gen1_mount`, `databricks_azure_adls_gen2_mount`, and `databricks_azure_blob_mount` have now `spark.scheduler.mode` as `FIFO` ([#828](https://github.com/databrickslabs/terraform-provider-databricks/pull/828))
* Fixed crash when using non-Azure authentication to mount Azure resources ([#831](https://github.com/databrickslabs/terraform-provider-databricks/issues/831))
* Fixed replacement of `instance_pool_id` in `databricks_cluster`, when `driver_instance_pool_id` was not explicitly specified ([#824](https://github.com/databrickslabs/terraform-provider-databricks/issues/824))
* Ingorning diff customization for permissions resource, so that new workspace deployments won't fail without explicit dependency on a workspace resource
* Multiple documentation improvements

**Deprecations**
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,18 @@ test-mws: install
@echo "✓ Running acceptance Tests for Multiple Workspace APIs on AWS..."
@/bin/bash scripts/run.sh mws '^TestMwsAcc' --debug --tee

test-gcp-accounts: install
@echo "✓ Running acceptance Tests for Multiple Workspace APIs on GCP..."
@/bin/bash scripts/run.sh gcp-accounts '^TestGcpAcc' --debug --tee

test-awsmt: install
@echo "✓ Running Terraform Acceptance Tests for AWS MT..."
@/bin/bash scripts/run.sh awsmt '^(TestAcc|TestAwsAcc)' --debug --tee

test-gcp-accounts: install
@echo "✓ Running acceptance Tests for Multiple Workspace APIs on GCP..."
@/bin/bash scripts/run.sh gcp-accounts '^TestGcpaAcc' --debug --tee

test-gcp: install
@echo "✓ Running acceptance Tests for GCP..."
@/bin/bash scripts/run.sh gcp '^(TestAcc|TestGcpAcc)' --debug --tee

test-preview: install
@echo "✓ Running acceptance Tests for Preview features..."
@/bin/bash scripts/run.sh preview '^TestPreviewAcc' --debug --tee
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ terraform {
required_providers {
databricks = {
source = "databrickslabs/databricks"
version = "0.3.7"
version = "0.3.8"
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions access/resource_permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,13 @@ func ResourcePermissions() *schema.Resource {
}
return &schema.Resource{
Schema: s,
CustomizeDiff: func(ctx context.Context, diff *schema.ResourceDiff, m interface{}) error {
me, err := identity.NewUsersAPI(ctx, m).Me()
CustomizeDiff: func(ctx context.Context, diff *schema.ResourceDiff, c interface{}) error {
client := c.(*common.DatabricksClient)
if client.Host == "" {
log.Printf("[WARN] cannot validate permission levels, because host is not known yet")
return nil
}
me, err := identity.NewUsersAPI(ctx, client).Me()
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions compute/clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,8 @@ func TestAzureAccNodeTypes(t *testing.T) {
ctx := context.Background()
clustersAPI := NewClustersAPI(ctx, common.CommonEnvironmentClient())
m := map[string]NodeTypeRequest{
"Standard_F4s": {},
"Standard_L32s_v2": {MinCores: 32, GBPerCore: 8},
"Standard_E4s_v4": {},
"Standard_E32s_v4": {MinCores: 32, GBPerCore: 8},
}

for k, v := range m {
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/aws-workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ terraform {
required_providers {
databricks = {
source = "databrickslabs/databricks"
version = "0.3.7"
version = "0.3.8"
}
aws = {
source = "hashicorp/aws"
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/workspace-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ terraform {
required_providers {
databricks = {
source = "databrickslabs/databricks"
version = "0.3.7"
version = "0.3.8"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ terraform {
required_providers {
databricks = {
source = "databrickslabs/databricks"
version = "0.3.7"
version = "0.3.8"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion mws/acceptance/workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestMwsAccWorkspaces(t *testing.T) {
})
}

func TestGcpAccWorkspaces(t *testing.T) {
func TestGcpAccaWorkspaces(t *testing.T) {
cloudEnv := os.Getenv("CLOUD_ENV")
if cloudEnv != "gcp-accounts" {
t.Skip("Acceptance tests skipped unless CLOUD_ENV=gcp-accounts is set")
Expand Down
2 changes: 1 addition & 1 deletion mws/resource_workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestMwsAccWorkspace(t *testing.T) {
t.Log(workspaceList)
}

func TestGcpAccWorkspace(t *testing.T) {
func TestGcpaAccWorkspace(t *testing.T) {
acctID := qa.GetEnvOrSkipTest(t, "DATABRICKS_ACCOUNT_ID")
client := common.CommonEnvironmentClient()
workspacesAPI := NewWorkspacesAPI(context.Background(), client)
Expand Down
6 changes: 6 additions & 0 deletions scripts/gcp-integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
make test-gcp
---

Used for running integration tests on GCP.

* `DATABRICKS_GOOGLE_SERVICE_ACCOUNT` is the account created through [this module](../gcp-accounts-integration/service-account/main.tf).
81 changes: 81 additions & 0 deletions scripts/gcp-integration/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
terraform {
required_providers {
databricks = {
source = "databrickslabs/databricks"
}
}
}

locals {
username = replace(split("@", data.google_client_openid_userinfo.me.email)[0], ".", "_")
prefix = "${local.username}-${random_string.naming.result}"
account_id = data.external.env.result.DATABRICKS_ACCOUNT_ID
}

data "external" "env" {
program = ["python", "-c", "import sys,os,json;json.dump(dict(os.environ), sys.stdout)"]
}

resource "random_string" "naming" {
special = false
upper = false
length = 6
}

// configured via env
provider "google" {}

// account_id & google_service_account configured via env
provider "databricks" {
alias = "accounts"
host = "https://accounts.gcp.databricks.com"
}

data "google_client_config" "current" {}

resource "databricks_mws_workspaces" "this" {
provider = databricks.accounts
account_id = local.account_id
workspace_name = local.prefix
location = data.google_client_config.current.region
cloud_resource_bucket {
gcp {
project_id = data.google_client_config.current.project
}
}
}

// google_service_account configured via env
provider "databricks" {
alias = "workspace"
host = databricks_mws_workspaces.this.workspace_url
}

data "google_client_openid_userinfo" "me" {}

data "databricks_group" "admins" {
depends_on = [databricks_mws_workspaces.this]
provider = databricks.workspace
display_name = "admins"
}

resource "databricks_user" "me" {
depends_on = [databricks_mws_workspaces.this]
provider = databricks.workspace
user_name = data.google_client_openid_userinfo.me.email
}

resource "databricks_group_member" "allow_me_to_admin" {
depends_on = [databricks_mws_workspaces.this]
provider = databricks.workspace
group_id = data.databricks_group.admins.id
member_id = databricks_user.me.id
}

output "databricks_host" {
value = databricks_mws_workspaces.this.workspace_url
}

output "cloud_env" {
value = "gcp"
}
5 changes: 5 additions & 0 deletions scripts/gcp-integration/require_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DATABRICKS_ACCOUNT_ID
DATABRICKS_GOOGLE_SERVICE_ACCOUNT
GOOGLE_PROJECT
GOOGLE_REGION
GOOGLE_ZONE