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

implement resource databricks_service_pricnipal #386

Closed
wants to merge 20 commits into from

Conversation

tcz001
Copy link
Contributor

@tcz001 tcz001 commented Oct 26, 2020

This should address #28

@tcz001
Copy link
Contributor Author

tcz001 commented Oct 26, 2020

One question about the SCIM service principal schema about Role, if not needed in Azure's context, should we remove them?

@TravisBuddy
Copy link

Hey @tcz001,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: d7d35b20-17e3-11eb-bc4d-2726ba7bdf50

@codecov-io
Copy link

codecov-io commented Oct 26, 2020

Codecov Report

Merging #386 (6a7f4c8) into master (1577a32) will increase coverage by 4.54%.
The diff coverage is 93.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #386      +/-   ##
==========================================
+ Coverage   76.32%   80.86%   +4.54%     
==========================================
  Files          65       63       -2     
  Lines        6636     6011     -625     
==========================================
- Hits         5065     4861     -204     
+ Misses       1172      759     -413     
+ Partials      399      391       -8     
Impacted Files Coverage Δ
compute/resource_cluster.go 70.61% <ø> (-4.58%) ⬇️
identity/groups.go 90.56% <ø> (+19.13%) ⬆️
identity/resource_service_principal.go 92.13% <92.13%> (ø)
compute/resource_job.go 81.57% <100.00%> (+8.36%) ⬆️
identity/resource_user.go 86.66% <100.00%> (ø)
identity/resource_user_instance_profile.go 100.00% <100.00%> (ø)
identity/scim.go 100.00% <100.00%> (ø)
identity/users.go 97.87% <100.00%> (+55.27%) ⬆️
provider/provider.go 94.11% <100.00%> (+2.42%) ⬆️
compute/libraries.go 68.04% <0.00%> (-30.93%) ⬇️
... and 1 more

@TravisBuddy
Copy link

Hey @tcz001,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: 4053db80-1806-11eb-bc4d-2726ba7bdf50

@nfx nfx self-requested a review October 27, 2020 16:38
@tcz001
Copy link
Contributor Author

tcz001 commented Oct 29, 2020

Hi @nfx, any feedback?

Copy link
Contributor

@nfx nfx left a comment

Choose a reason for hiding this comment

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

Looks good, some remarks:

  • remove methods that are not needed
  • rename some of the methods
  • add 90% code coverage for new code (there's drop of 15% in SCIM in this PR)

docs/resources/service_principal.md Outdated Show resolved Hide resolved
}

resource "databricks_service_principal" "me" {
application_id = "00000000-0000-0000-0000-000000000000"
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm currently running this by our engineering folks to agree on name for this field, because service principal identification might look differently on AWS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

any suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

still internal discussions :) i'll try to run this PR against AWS deployment this week

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nfx I removed the code related with Role (seems only an aws concept)from service principal, if you want to keep it just revert this commit: de41db0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nfx any updates?

identity/scim.go Outdated
@@ -45,6 +46,13 @@ type UserPatchOperations struct {
Value *GroupsValue `json:"value,omitempty"`
}

// ServicePrincipalPatchOperations is a list of path operations for add or removing service principal attributes
type ServicePrincipalPatchOperations struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

there's no need to create a dedicated *PatchOperations struct, you can reuse the user one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good, will change it, but should we rename the struct of UserPatchOperation to make it more abstract?

Copy link
Contributor Author

@tcz001 tcz001 Nov 2, 2020

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@tcz001 yes, it can be just PathOperations

identity/scim.go Outdated Show resolved Hide resolved
identity/service_principals.go Outdated Show resolved Hide resolved
identity/service_principals.go Outdated Show resolved Hide resolved
identity/service_principals.go Outdated Show resolved Hide resolved
identity/service_principals.go Outdated Show resolved Hide resolved
identity/service_principals.go Outdated Show resolved Hide resolved
identity/service_principals.go Outdated Show resolved Hide resolved
@nfx nfx linked an issue Oct 30, 2020 that may be closed by this pull request
@nfx
Copy link
Contributor

nfx commented Oct 30, 2020

+change to databricks_permissions resource doc in this particular case

@TravisBuddy
Copy link

Travis tests have failed

Hey @tcz001,
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.

1st 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
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
curl -sSfL https://raw.githubusercontent.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
time make lint
✓ Linting source code with golangci-lint make sure you run make fmt ...
make: golangci-lint: Command not found
Makefile:10: recipe for target 'lint' failed
make: *** [lint] Error 127

real	0m0.007s
user	0m0.003s
sys	0m0.001s
time make test
✓ Running tests...
make: gotestsum: Command not found
Makefile:14: recipe for target 'test' failed
make: *** [test] Error 127

real	0m0.003s
user	0m0.003s
sys	0m0.000s

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://raw.githubusercontent.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://raw.githubusercontent.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 ...
identity/service_principals.go:106:18: SA4010: this result of append is never used, except maybe in other appends (staticcheck)
		groups = append(groups, group)
		               ^
Makefile:10: recipe for target 'lint' failed
make: *** [lint] Error 1

real	0m30.614s
user	0m54.133s
sys	0m1.943s
The command "time make lint" exited with 2.
$ time make test
✓ Running tests...
go: downloading github.com/Azure/go-autorest/autorest v0.11.9
go: downloading gopkg.in/ini.v1 v1.62.0
go: downloading golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
go: downloading github.com/Azure/go-autorest/autorest/azure/cli v0.4.2
go: downloading github.com/Azure/go-autorest/autorest/azure/auth v0.5.3
go: downloading github.com/Azure/go-autorest/autorest/adal v0.9.5
go: downloading github.com/form3tech-oss/jwt-go v3.2.2+incompatible
∅  .
✓  access (128ms) (coverage: 85.6% of statements)
✓  access/acceptance (74ms)
✓  common (71ms) (coverage: 67.8% of statements)
✓  compute/acceptance (17ms)
✓  compute (1.724s) (coverage: 75.3% of statements)
✓  identity (111ms) (coverage: 51.0% of statements)
✓  internal (9ms) (coverage: 67.5% of statements)
✓  identity/acceptance (16ms)
∅  internal/acceptance
✓  internal/qa (9ms) (coverage: 68.3% of statements)
✓  internal/util (13ms) (coverage: 96.4% of statements)
✓  internal/sanity (18ms) (coverage: 100.0% of statements)
✓  mws/acceptance (15ms)
✓  mws (1.103s) (coverage: 73.2% of statements)
✓  provider (137ms) (coverage: 70.2% of statements)
✓  storage (101ms) (coverage: 81.2% of statements)
✓  storage/acceptance (39ms)
✓  workspace/acceptance (15ms)
✓  workspace (10.058s) (coverage: 84.4% of statements)

DONE 530 tests, 86 skipped in 39.783s

real	0m39.789s
user	0m50.817s
sys	0m6.055s
The command "time make test" exited with 0.
$ time make build
✓ Building source code with go build...
github.com/databrickslabs/databricks-terraform

real	0m2.767s
user	0m3.462s
sys	0m0.388s
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/00050fc528d0d5ec3b568c5f389793ae46cabe95bb4f6387d807f2fb890d416b-a
/home/travis/.cache/go-build/00/001673359ec69b7ddc98d3a059b1b290ffe519ae396d9205bd66cfa20ac01517-a
/home/travis/.cache/go-build/00/00437a8e700c69b8146a1ccf9e4f2a9c8a0499de4db7fb72f9ba1cc0e9aa3730-d
/home/travis/.cache/go-build/00/0065004ae109361e5913261401b6b002149941942c821ec26c9322c88537113b-d
/home/travis/.cache/go-build/00/0081ab47ab3314d9a102af4296c3b197ce1cec238687fa7228831d83dcb2d619-a
/home/travis/.cache/go-build/00/0086bac0b5a8648731e6a6fc0a442e0d787634f4bdc7e742c333cd1b2efbe5a8-a
/home/travis/.cache/go-build/00/008cda3a68c44f30c28543f5ac7e13353a57972b5ac977c1e80b840b13783b79-d
/home/travis/.cache/go-build/00/00d5097494faf39b2a5c630f2c9a92a13afeb5232b731e341ac6a6b226e35e92-d
/home/travis/.cache/go-build/00/00ee15c067d1df3953f4dbd21e33bbcc1b462913d0a327a52f707ec7879b7165-d
/home/travis/.cache/go-build/00/00f2aba21209737bdfc83fb6ed3958c0de3d2312694ba057c934f893a3ac7633-a
/home/trav\n...
changes detected, packing new archive
uploading PR.386/cache--linux-xenial-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855--go-1.14.x.tgz
cache uploaded


Done. Your build exited with 1.
curl -sSfL https://raw.githubusercontent.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 ...
identity/service_principals.go:106:18: SA4010: this result of append is never used, except maybe in other appends (staticcheck)
		groups = append(groups, group)
		               ^
Makefile:10: recipe for target 'lint' failed
make: *** [lint] Error 1

real	0m30.614s
user	0m54.133s
sys	0m1.943s
TravisBuddy Request Identifier: 67ea7ff0-1d51-11eb-8505-818d591f0ed7

@TravisBuddy
Copy link

Travis tests have failed

Hey @tcz001,
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.

1st 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://raw.githubusercontent.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://raw.githubusercontent.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 ...
identity/service_principals.go:106:18: SA4010: this result of append is never used, except maybe in other appends (staticcheck)
		groups = append(groups, group)
		               ^
Makefile:10: recipe for target 'lint' failed
make: *** [lint] Error 1

real	0m39.741s
user	0m51.555s
sys	0m2.444s
The command "time make lint" exited with 2.
$ time make test
✓ Running tests...
go: downloading github.com/Azure/go-autorest/autorest v0.11.9
go: downloading golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
go: downloading gopkg.in/ini.v1 v1.62.0
go: extracting github.com/Azure/go-autorest/autorest v0.11.9
go: downloading github.com/Azure/go-autorest/autorest/adal v0.9.5
go: downloading github.com/Azure/go-autorest/autorest/azure/cli v0.4.2
go: extracting gopkg.in/ini.v1 v1.62.0
go: downloading github.com/Azure/go-autorest/autorest/azure/auth v0.5.3
go: extracting github.com/Azure/go-autorest/autorest/adal v0.9.5
go: downloading github.com/form3tech-oss/jwt-go v3.2.2+incompatible
go: extracting github.com/Azure/go-autorest/autorest/azure/cli v0.4.2
go: extracting github.com/Azure/go-autorest/autorest/azure/auth v0.5.3
go: extracting github.com/form3tech-oss/jwt-go v3.2.2+incompatible
go: extracting golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
go: finding github.com/Azure/go-autorest/autorest v0.11.9
go: finding github.com/Azure/go-autorest/autorest/adal v0.9.5
go: finding github.com/Azure/go-autorest/autorest/azure/auth v0.5.3
go: finding github.com/Azure/go-autorest/autorest/azure/cli v0.4.2
go: finding gopkg.in/ini.v1 v1.62.0
go: finding golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
go: finding github.com/form3tech-oss/jwt-go v3.2.2+incompatible
∅  .
✓  access/acceptance (23ms)
✓  access (106ms) (coverage: 85.6% of statements)
✓  common (71ms) (coverage: 67.8% of statements)
✓  compute/acceptance (22ms)
✓  compute (1.738s) (coverage: 75.3% of statements)
✓  identity (117ms) (coverage: 51.0% of statements)
✓  internal (14ms) (coverage: 67.5% of statements)
✓  identity/acceptance (19ms)
∅  internal/acceptance
✓  internal/qa (18ms) (coverage: 68.3% of statements)
✓  internal/util (12ms) (coverage: 96.4% of statements)
✓  internal/sanity (21ms) (coverage: 100.0% of statements)
✓  mws/acceptance (15ms)
✓  mws (1.072s) (coverage: 73.2% of statements)
✓  provider (281ms) (coverage: 70.2% of statements)
✓  storage (70ms) (coverage: 81.2% of statements)
✓  storage/acceptance (23ms)
✓  workspace/acceptance (13ms)
✓  workspace (10.09s) (coverage: 84.4% of statements)

DONE 530 tests, 86 skipped in 76.542s

real	1m16.547s
user	1m54.368s
sys	0m12.600s
The command "time make test" exited with 0.
$ time make build
✓ Building source code with go build...
github.com/databrickslabs/databricks-terraform

real	0m2.950s
user	0m3.453s
sys	0m0.453s
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/002ddcdb44faa8cfe442e007d1cf0bbb69cab774017d265315c07854f882e1b0-a
/home/travis/.cache/go-build/00/0033ec143136f99ec845a55b9acc195f6e692e7556fe767acf31d4088c4cf3ca-a
/home/travis/.cache/go-build/00/00521d4640144ae9d52e3a4ff95f58b694beba5f33baea87ee9099416eb3f5cc-a
/home/travis/.cache/go-build/00/0091c1773c9d4d1f5fb3f4e796d6b9000fbd88f20020aaee457f930d94a9a7a1-a
/home/travis/.cache/go-build/00/00aea83c5697eb371dc9c05e4aef7ee6ead0643f59dcf92a5ed1a84b939da425-a
/home/travis/.cache/go-build/00/00ce35b45ed530ad8cfbb595da7b554b1b6c7413ced73397a460b9e9e4c851a5-a
/home/travis/.cache/go-build/00/00d5097494faf39b2a5c630f2c9a92a13afeb5232b731e341ac6a6b226e35e92-d
/home/travis/.cache/go-build/00/00ee15c067d1df3953f4dbd21e33bbcc1b462913d0a327a52f707ec7879b7165-d
/home/travis/.cache/go-build/00/00f04da442f2adc07a1a39d9ab2ca05420b115bc6e940d66771af9aeb4346536-a
/home/travis/.cache/go-build/00/00f3dee429996242217d6baac41d21aaa3ba5b3c4edf8832a09d45d101ce3bed-d
/home/trav\n...
changes detected, packing new archive
uploading PR.386/cache--linux-xenial-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855--go-1.13.x.tgz
cache uploaded


Done. Your build exited with 1.
curl -sSfL https://raw.githubusercontent.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 ...
identity/service_principals.go:106:18: SA4010: this result of append is never used, except maybe in other appends (staticcheck)
		groups = append(groups, group)
		               ^
Makefile:10: recipe for target 'lint' failed
make: *** [lint] Error 1

real	0m39.741s
user	0m51.555s
sys	0m2.444s

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://raw.githubusercontent.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://raw.githubusercontent.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 ...
identity/service_principals.go:106:18: SA4010: this result of append is never used, except maybe in other appends (staticcheck)
		groups = append(groups, group)
		               ^
Makefile:10: recipe for target 'lint' failed
make: *** [lint] Error 1

real	0m24.281s
user	0m43.003s
sys	0m1.256s
The command "time make lint" exited with 2.
$ time make test
✓ Running tests...
∅  .
✓  access (65ms) (coverage: 85.6% of statements)
✓  access/acceptance (19ms)
✓  common (47ms) (coverage: 67.8% of statements)
✓  compute/acceptance (18ms)
✓  identity (67ms) (coverage: 51.0% of statements)
✓  compute (1.755s) (coverage: 75.3% of statements)
✓  internal (9ms) (coverage: 67.5% of statements)
✓  identity/acceptance (22ms)
∅  internal/acceptance
✓  internal/qa (14ms) (coverage: 68.3% of statements)
✓  internal/util (14ms) (coverage: 96.4% of statements)
✓  internal/sanity (20ms) (coverage: 100.0% of statements)
✓  mws/acceptance (15ms)
✓  mws (1.063s) (coverage: 73.2% of statements)
✓  provider (114ms) (coverage: 70.2% of statements)
✓  storage (86ms) (coverage: 81.2% of statements)
✓  storage/acceptance (24ms)
✓  workspace/acceptance (13ms)
✓  workspace (10.057s) (coverage: 84.4% of statements)

DONE 530 tests, 86 skipped in 35.471s

real	0m35.477s
user	0m35.127s
sys	0m4.568s
The command "time make test" exited with 0.
$ time make build
✓ Building source code with go build...

real	0m2.681s
user	0m3.369s
sys	0m0.378s
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/00/00ee15c067d1df3953f4dbd21e33bbcc1b462913d0a327a52f707ec7879b7165-d
/home/travis/.cache/go-build/02/022252c6191f3bbf2bc0044a2d7f48702ce17354ab39571a03db8aaa8f3a746c-d
/home/travis/.cache/go-build/02/02b1561ca1f577a60872ca4be74362ed9444a7d73d23fe7aa466be4a49695209-a
/home/travis/.cache/go-build/04/04549fb10e0d1b40a62f96324dcb6521080f9eabdbcd4812893a69176546f5a9-d
/home/travis/.cache/go-build/04/04b6c2d33b365a62a57184b211543e75af6941ec9b1b30af86af85a72608ea62-d
/home/travis/.cache/go-build/05/0550cc22e15880f40f372f9095cbcf3ce027276583dec3e19624c96c1f1f4210-a
/home/travis/.cache/go-build/05/0555382749913d38a237e37c2c1c817c7def21ff345fdc9772a8b9eb3f5ae56f-a
/home/travis/.cache/go-build/05/05e11e37df5658d788f359b6f20e4f6cbed5540b6bebe970b10b39e0f6fc207e-d
/home/travis/.cache/go-build/08/086e060e035a04294ddb32d69b508ff4d95cb7f9f5c24dcaa11fc92fb9f14a38-d
/home/trav\n...
changes detected, packing new archive
uploading PR.386/cache--linux-xenial-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855--go-1.14.x.tgz
cache uploaded


Done. Your build exited with 1.
curl -sSfL https://raw.githubusercontent.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 ...
identity/service_principals.go:106:18: SA4010: this result of append is never used, except maybe in other appends (staticcheck)
		groups = append(groups, group)
		               ^
Makefile:10: recipe for target 'lint' failed
make: *** [lint] Error 1

real	0m24.281s
user	0m43.003s
sys	0m1.256s
TravisBuddy Request Identifier: 6c03de20-1d64-11eb-8505-818d591f0ed7

@TravisBuddy
Copy link

Hey @tcz001,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: 8eafb0f0-1d75-11eb-8505-818d591f0ed7

@TravisBuddy
Copy link

Hey @tcz001,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: a296b680-200a-11eb-9dab-419bf2960c30

@TravisBuddy
Copy link

Hey @tcz001,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: 34a11d70-2062-11eb-9dab-419bf2960c30

@TravisBuddy
Copy link

Hey @tcz001,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: 20f81f60-22bc-11eb-b1e0-17a3b2b69400

@tcz001
Copy link
Contributor Author

tcz001 commented Nov 10, 2020

Hi @nfx any further feedback?

Copy link
Contributor

@nfx nfx left a comment

Choose a reason for hiding this comment

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

Minor changes requested

@@ -92,7 +92,7 @@ resource "databricks_permissions" "policy_usage" {

## Instance Pool usage

[Instance Pools](instance_pool.md) access control [allows to](https://docs.databricks.com/security/access-control/pool-acl.html) assign `CAN_ATTACH_TO` and `CAN_MANAGE` permissions to users and groups. It's also possible to grant creation of Instance Pools to individual [groups](group.md#allow_instance_pool_create) and [users](user.md#allow_instance_pool_create).
[Instance Pools](instance_pool.md) access control [allows to](https://docs.databricks.com/security/access-control/pool-acl.html) assign `CAN_ATTACH_TO` and `CAN_MANAGE` permissions to users, service principals and groups. It's also possible to grant creation of Instance Pools to individual [groups](group.md#allow_instance_pool_create) and [users](user.md#allow_instance_pool_create), [service principals](service_principal.md#allow_instance_pool_create).
Copy link
Contributor

Choose a reason for hiding this comment

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

to use consistent punctuation, please add coma before and

Copy link
Contributor Author

@tcz001 tcz001 Nov 10, 2020

Choose a reason for hiding this comment

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

Hi @nfx , sorry I'm a bit lost on these comments because I'm not english native speaker, to save the time, can you maybe directly push to my branch, if you don't have access to push please let me know. https://github.com/tcz001/terraform-provider-databricks-1/invitations

@@ -52,7 +52,7 @@ resource "databricks_permissions" "cluster_usage" {

## Cluster Policy usage

Cluster policies allow creation of [clusters](cluster.md), that match [given policy](https://docs.databricks.com/administration-guide/clusters/policies.html). It's possible to assign `CAN_USE` permission to users and groups:
Cluster policies allow creation of [clusters](cluster.md), that match [given policy](https://docs.databricks.com/administration-guide/clusters/policies.html). It's possible to assign `CAN_USE` permission to users, service principals and groups:
Copy link
Contributor

Choose a reason for hiding this comment

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

to use consistent punctuation, please add coma before and

@@ -128,12 +128,12 @@ resource "databricks_permissions" "pool_usage" {

## Job usage

Copy link
Contributor

Choose a reason for hiding this comment

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

to use consistent punctuation, please add coma before and

@@ -128,12 +128,12 @@ resource "databricks_permissions" "pool_usage" {

## Job usage

There are four assignable [permission levels](https://docs.databricks.com/security/access-control/jobs-acl.html#job-permissions) for [databricks_job](job.md): `CAN_VIEW`, `CAN_MANAGE_RUN`, `IS_OWNER`, and `CAN_MANAGE`. Admins are granted the `CAN_MANAGE` permission by default, and they can assign that permission to non-admin users.
There are four assignable [permission levels](https://docs.databricks.com/security/access-control/jobs-acl.html#job-permissions) for [databricks_job](job.md): `CAN_VIEW`, `CAN_MANAGE_RUN`, `IS_OWNER`, and `CAN_MANAGE`. Admins are granted the `CAN_MANAGE` permission by default, and they can assign that permission to non-admin users and service principals.
Copy link
Contributor

Choose a reason for hiding this comment

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

to use consistent punctuation, please add coma before and


* The creator of a job has `IS_OWNER` permission. Destroying `databricks_permissions` resource for a job would revert ownership to creator.
* A job must have exactly one owner. If resource is changed and no owner is specified, currently authenticated principal would become new owner of the job. Nothing would change, per se, if the job was created through Terraform.
* A job cannot have a group as an owner.
* Jobs triggered through *Run Now* assume the permissions of the job owner and not the user who issued Run Now.
* Jobs triggered through *Run Now* assume the permissions of the job owner and not the user and service principal who issued Run Now.
Copy link
Contributor

Choose a reason for hiding this comment

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

to use consistent punctuation, please add coma before and

* All users have `CAN_MANAGE` permission for items in the Workspace > Shared Icon Shared folder. You can grant `CAN_MANAGE` permission to notebooks and folders by moving them to the Shared Icon Shared folder.
* All users have `CAN_MANAGE` permission for objects the user creates.
* User home directory - The user has `CAN_MANAGE` permission. All other users can list their directories.
* All users(or service principals) have `CAN_MANAGE` permission for items in the Workspace > Shared Icon Shared folder. You can grant `CAN_MANAGE` permission to notebooks and folders by moving them to the Shared Icon Shared folder.
Copy link
Contributor

Choose a reason for hiding this comment

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

space before opening bracket

@@ -273,7 +273,7 @@ resource "databricks_permissions" "folder_usage" {

## Passwords usage

By default on AWS deployments, all admin users can sign in to Databricks using either SSO or their username and password, and all API users can authenticate to the Databricks REST APIs using their username and password. As an admin, you [can limit](https://docs.databricks.com/administration-guide/users-groups/single-sign-on/index.html#optional-configure-password-access-control) admin users’ and API users’ ability to authenticate with their username and password by configuring `CAN_USE` permissions using password access control.
By default on AWS deployments, all admin users(or service principals) can sign in to Databricks using either SSO or their username and password, and all API users(or service principals) can authenticate to the Databricks REST APIs using their username and password. As an admin, you [can limit](https://docs.databricks.com/administration-guide/users-groups/single-sign-on/index.html#optional-configure-password-access-control) admin users’ and API users’ ability to authenticate with their username and password by configuring `CAN_USE` permissions using password access control.
Copy link
Contributor

Choose a reason for hiding this comment

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

space before opening bracket

@nfx
Copy link
Contributor

nfx commented Nov 19, 2020

@tcz001 good news! we can merge changes with application_id field. please finish up existing comments and let's get ready to merge.

@avillalain
Copy link

Hi @nfx, we pushed some changes based on your comments regarding the documentation. We are colleagues of @tcz001 and he is away for a while, so our team will take care of the changes in the meantime. Let us know if there is anything else missing from the comments or if there's anything else we need to take care of. Thanks

Copy link
Contributor

@nfx nfx left a comment

Choose a reason for hiding this comment

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

Looks good! I'll aim to include it in v0.3.0 release

@nfx
Copy link
Contributor

nfx commented Nov 24, 2020

@avillalain please resolve conflicts in docs/resources/permissions.md and change any go file with a whitespace, so that CI triggers.

@avillalain
Copy link

@nfx conflicts are resolved. Thanks

nfx added a commit that referenced this pull request Dec 3, 2020
Directly creates service principal, that could be added to a group within workspace.

```hcl
resource "databricks_service_principal" "sp" {
  application_id = "00000000-0000-0000-0000-000000000000"
}
```

Co-authored-by: tcz001 <fan.torchz@gmail.com>
Co-authored-by: Angel Villalain Garcia <avillalaingarcia@humana.com>
Co-authored-by: Serge Smertin <serge.smertin@databricks.com>
@nfx
Copy link
Contributor

nfx commented Dec 3, 2020

congratulations @tcz001 , @avillalain , it's merged in #432 and is going to be part of 0.3.0 release.

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.

[FEATURE] SCIM service principal resource
6 participants