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

Added databricks_workspace_conf resource #398

Merged
merged 5 commits into from
Nov 4, 2020
Merged

Conversation

nfx
Copy link
Contributor

@nfx nfx commented Nov 3, 2020

databricks_workspace_conf Resource

Manages workspace configuration for expert usage. Currently, more than one instance of resource can exist in Terraform state, though there's no deterministic behavior, when they manage same property. We strongly recommend to use single databricks_workspace_conf per workspace.

Example Usage

Allows specification of custom configuration properties for expert usage:

  • enableIpAccessLists - enables the use of databricks_ip_access_list resources
resource "databricks_workspace_conf" "this" {
    custom_config = {
        "enableIpAccessLists": true
    }
}

Argument Reference

The following arguments are available:

  • custom_config - (Required) Key-value map of strings, that represent workspace configuration. Upon resource deletion, properties that start with enable or enforce will be reset to false value, regardless of initial default one.

Import

This resource cannot support import.

@nfx nfx requested a review from jarobey November 3, 2020 19:55
@nfx nfx added this to the v0.2.8 milestone Nov 3, 2020
@TravisBuddy
Copy link

Travis tests have failed

Hey @nfx,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

2nd Build

View build log

curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v0.4.2/gotestsum_0.4.2_linux_amd64.tar.gz" | sudo tar -xz -C /usr/local/bin gotestsum
The command "curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v0.4.2/gotestsum_0.4.2_linux_amd64.tar.gz" | sudo tar -xz -C /usr/local/bin gotestsum" exited with 0.
$ curl -sSfL https://github.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.25.0
golangci/golangci-lint info checking GitHub for tag 'v1.25.0'
golangci/golangci-lint info found version: 1.25.0 for v1.25.0/linux/amd64
golangci/golangci-lint info installed /home/travis/gopath/bin/golangci-lint
The command "curl -sSfL https://github.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.25.0" exited with 0.
$ time make lint
✓ Linting source code with golangci-lint make sure you run make fmt ...
workspace/resource_workspace_conf.go:60:8: Error return value of `d.Set` is not checked (errcheck)
		d.Set("custom_config", config)
		     ^
workspace/acceptance/workspace_conf_test.go:7: File is not `goimports`-ed (goimports)
	"github.com/databrickslabs/databricks-terraform/internal/acceptance"
Makefile:10: recipe for target 'lint' failed
make: *** [lint] Error 1

real	0m25.818s
user	0m46.320s
sys	0m1.517s
The command "time make lint" exited with 2.
$ time make test
✓ Running tests...
∅  .
✓  access (71ms) (coverage: 85.0% of statements)
✓  common (37ms) (coverage: 67.8% of statements)
✓  access/acceptance (25ms)
✓  compute (1.667s) (coverage: 75.3% of statements)
✓  compute/acceptance (26ms)
✓  identity (116ms) (coverage: 48.9% of statements)
✓  internal (11ms) (coverage: 67.5% of statements)
✓  identity/acceptance (20ms)
∅  internal/acceptance
✓  internal/qa (17ms) (coverage: 68.3% of statements)
✓  internal/util (14ms) (coverage: 96.4% of statements)
✓  internal/sanity (37ms) (coverage: 100.0% of statements)
✓  mws (1.099s) (coverage: 74.6% of statements)
✓  mws/acceptance (25ms)
✓  provider (146ms) (coverage: 70.2% of statements)
✓  storage (105ms) (coverage: 81.2% of statements)
✓  storage/acceptance (28ms)
✓  workspace/acceptance (14ms)
=== RUN   TestWorkspaceConfCreate
    resource_workspace_conf_test.go:53: 
        	Error Trace:	resource_workspace_conf_test.go:53
        	Error:      	Received unexpected error:
        	            	Invalid config supplied. [enable_ip_access_lists] Invalid or unknown key
        	Test:       	TestWorkspaceConfCreate
        	Messages:   	Invalid config supplied. [enable_ip_access_lists] Invalid or unknown key
--- FAIL: TestWorkspaceConfCreate (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xe9de41]

goroutine 150 [running]:
testing.tRunner.func1.1(0xfc6da0, 0x1bc6db0)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:999 +0x319
testing.tRunner.func1(0xc000339320)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1002 +0x402
panic(0xfc6da0, 0x1bc6db0)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/runtime/panic.go:969 +0x166
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Id(...)
	/home/travis/gopath/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.0.2-0.20200828083434-d39628234432/helper/schema/resource_data.go:208
github.com/databrickslabs/databricks-terraform/workspace.TestWorkspaceConfCreate(0xc000339320)
	/home/travis/gopath/src/github.com/databrickslabs/terraform-provider-databricks/workspace/resource_workspace_conf_test.go:54 +0x331
testing.tRunner(0xc000339320, 0x1174240)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1050 +0xdc
created by testing.(*T).Run
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1095 +0x28b
✖  workspace (10.047s)

=== Failed
=== FAIL: workspace TestWorkspaceConfCreate (0.00s)
    resource_workspace_conf_test.go:53: 
        	Error Trace:	resource_workspace_conf_test.go:53
        	Error:      	Received unexpected error:
        	            	Invalid config supplied. [enable_ip_access_lists] Invalid or unknown key
        	Test:       	TestWorkspaceConfCreate
        	Messages:   	Invalid config supplied. [enable_ip_access_lists] Invalid or unknown key
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xe9de41]

goroutine 150 [running]:
testing.tRunner.func1.1(0xfc6da0, 0x1bc6db0)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:999 +0x319
testing.tRunner.func1(0xc000339320)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1002 +0x402
panic(0xfc6da0, 0x1bc6db0)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/runtime/panic.go:969 +0x166
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Id(...)
	/home/travis/gopath/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.0.2-0.20200828083434-d39628234432/helper/schema/resource_data.go:208
github.com/databrickslabs/databricks-terraform/workspace.TestWorkspaceConfCreate(0xc000339320)
	/home/travis/gopath/src/github.com/databrickslabs/terraform-provider-databricks/workspace/resource_workspace_conf_test.go:54 +0x331
testing.tRunner(0xc000339320, 0x1174240)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1050 +0xdc
created by testing.(*T).Run
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1095 +0x28b


DONE 519 tests, 86 skipped, 1 failure in 34.913s
Makefile:14: recipe for target 'test' failed
make: *** [test] Error 1

real	0m34.922s
user	0m36.989s
sys	0m4.577s
The command "time make test" exited with 2.
$ time make build
✓ Building source code with go build...

real	0m2.830s
user	0m3.506s
sys	0m0.406s
The command "time make build" exited with 0.
store build cache
changes detected (content changed, file is created, or file is deleted):\n/home/travis/.cache/go-build/00/001673359ec69b7ddc98d3a059b1b290ffe519ae396d9205bd66cfa20ac01517-a
/home/travis/.cache/go-build/01/01be69c8cb725dc73070bb9129ffbb4001a9de9f98604fbe60d2426d8fb86c57-a
/home/travis/.cache/go-build/02/0244828126f4ec7c8302cc9444e4f2b1a94a1d2b0fd1b4fbcff09543dc3af1fa-a
/home/travis/.cache/go-build/05/05062d486ebb25258daf60ce20c0d3863eff53387c1c2b02e6c919bc1ec44800-d
/home/travis/.cache/go-build/06/068890e427a66653ab30f6948f1f326b348b321fa8ab12a06d8db9cdbd727c9e-d
/home/travis/.cache/go-build/07/072766bae1b45c5c46a7aba3a7e9c559a28724c9b5e09ec13e61ec0a952a8837-a
/home/travis/.cache/go-build/08/087811409a4f4b3a64e0bf59eaca00e084cbc7a065ec97825f6d0c39d0055861-a
/home/travis/.cache/go-build/09/09473c7b05f3278750ce030e28742590a9a6cbbf00b37351eeb8eb8a1a2070f3-a
/home/travis/.cache/go-build/0a/0a9adf9a44a1562b99c6c888098f418d3482bad8319c1492415c9b7f62c00c90-a
/home/travis/.cache/go-build/0d/0dbfda6d010e1d4fe83f3311273f87ed37d7b1cc86f8a94803948e50b2dba3a8-a
/home/trav\n...
changes detected, packing new archive
uploading PR.398/cache--linux-xenial-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855--go-1.14.x.tgz
cache uploaded


Done. Your build exited with 1.
curl -sSfL https://github.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.25.0
golangci/golangci-lint info checking GitHub for tag 'v1.25.0'
golangci/golangci-lint info found version: 1.25.0 for v1.25.0/linux/amd64
golangci/golangci-lint info installed /home/travis/gopath/bin/golangci-lint
time make lint
✓ Linting source code with golangci-lint make sure you run make fmt ...
workspace/resource_workspace_conf.go:60:8: Error return value of `d.Set` is not checked (errcheck)
		d.Set("custom_config", config)
		     ^
workspace/acceptance/workspace_conf_test.go:7: File is not `goimports`-ed (goimports)
	"github.com/databrickslabs/databricks-terraform/internal/acceptance"
Makefile:10: recipe for target 'lint' failed
make: *** [lint] Error 1

real	0m25.818s
user	0m46.320s
sys	0m1.517s
time make test
✓ Running tests...
∅  .
✓  access (71ms) (coverage: 85.0% of statements)
✓  common (37ms) (coverage: 67.8% of statements)
✓  access/acceptance (25ms)
✓  compute (1.667s) (coverage: 75.3% of statements)
✓  compute/acceptance (26ms)
✓  identity (116ms) (coverage: 48.9% of statements)
✓  internal (11ms) (coverage: 67.5% of statements)
✓  identity/acceptance (20ms)
∅  internal/acceptance
✓  internal/qa (17ms) (coverage: 68.3% of statements)
✓  internal/util (14ms) (coverage: 96.4% of statements)
✓  internal/sanity (37ms) (coverage: 100.0% of statements)
✓  mws (1.099s) (coverage: 74.6% of statements)
✓  mws/acceptance (25ms)
✓  provider (146ms) (coverage: 70.2% of statements)
✓  storage (105ms) (coverage: 81.2% of statements)
✓  storage/acceptance (28ms)
✓  workspace/acceptance (14ms)
=== RUN   TestWorkspaceConfCreate
    resource_workspace_conf_test.go:53: 
        	Error Trace:	resource_workspace_conf_test.go:53
        	Error:      	Received unexpected error:
        	            	Invalid config supplied. [enable_ip_access_lists] Invalid or unknown key
        	Test:       	TestWorkspaceConfCreate
        	Messages:   	Invalid config supplied. [enable_ip_access_lists] Invalid or unknown key
--- FAIL: TestWorkspaceConfCreate (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xe9de41]

goroutine 150 [running]:
testing.tRunner.func1.1(0xfc6da0, 0x1bc6db0)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:999 +0x319
testing.tRunner.func1(0xc000339320)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1002 +0x402
panic(0xfc6da0, 0x1bc6db0)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/runtime/panic.go:969 +0x166
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Id(...)
	/home/travis/gopath/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.0.2-0.20200828083434-d39628234432/helper/schema/resource_data.go:208
github.com/databrickslabs/databricks-terraform/workspace.TestWorkspaceConfCreate(0xc000339320)
	/home/travis/gopath/src/github.com/databrickslabs/terraform-provider-databricks/workspace/resource_workspace_conf_test.go:54 +0x331
testing.tRunner(0xc000339320, 0x1174240)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1050 +0xdc
created by testing.(*T).Run
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1095 +0x28b
✖  workspace (10.047s)

=== Failed
=== FAIL: workspace TestWorkspaceConfCreate (0.00s)
    resource_workspace_conf_test.go:53: 
        	Error Trace:	resource_workspace_conf_test.go:53
        	Error:      	Received unexpected error:
        	            	Invalid config supplied. [enable_ip_access_lists] Invalid or unknown key
        	Test:       	TestWorkspaceConfCreate
        	Messages:   	Invalid config supplied. [enable_ip_access_lists] Invalid or unknown key
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xe9de41]

goroutine 150 [running]:
testing.tRunner.func1.1(0xfc6da0, 0x1bc6db0)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:999 +0x319
testing.tRunner.func1(0xc000339320)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1002 +0x402
panic(0xfc6da0, 0x1bc6db0)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/runtime/panic.go:969 +0x166
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Id(...)
	/home/travis/gopath/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.0.2-0.20200828083434-d39628234432/helper/schema/resource_data.go:208
github.com/databrickslabs/databricks-terraform/workspace.TestWorkspaceConfCreate(0xc000339320)
	/home/travis/gopath/src/github.com/databrickslabs/terraform-provider-databricks/workspace/resource_workspace_conf_test.go:54 +0x331
testing.tRunner(0xc000339320, 0x1174240)
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1050 +0xdc
created by testing.(*T).Run
	/home/travis/.gimme/versions/go1.14.10.linux.amd64/src/testing/testing.go:1095 +0x28b


DONE 519 tests, 86 skipped, 1 failure in 34.913s
Makefile:14: recipe for target 'test' failed
make: *** [test] Error 1

real	0m34.922s
user	0m36.989s
sys	0m4.577s
TravisBuddy Request Identifier: cccf3ee0-1e16-11eb-8505-818d591f0ed7

Copy link
Contributor

@jarobey jarobey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the updates. Much more flexible map with keyjoin for values and proper for loops for setting :). Dubious commented out acceptance test. Not sure why the delete in the test framework tries to use the IP Access List API to delete a Workspace Conf object.

        InstanceState: map[string]string{
			"custom_config.enableSomething": "true",
		},
		HCL: `custom_config {
			enableIpAccessLists = "true"
		}`,
@TravisBuddy
Copy link

Hey @nfx,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: b52d0400-1ecc-11eb-b069-4b84fe73ac29

@nfx nfx merged commit 4177d1e into master Nov 4, 2020
@nfx nfx deleted the feature/workspace-conf branch November 4, 2020 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants