databricks-cli/bundle/config
shreyas-goenka 1d9bf4b2c4
Add legacy option for `run_as` (#1384)
## Changes
This PR partially reverts the changes in
https://github.com/databricks/cli/pull/1233 and puts the old code under
an "experimental.use_legacy_run_as" configuration. This gives customers
who ran into the breaking change made in the PR a way out.


## Tests
Both manually and via unit tests.

Manually verified that run_as works for pipelines now. And if a user
wants to use the feature they need to be both a Metastore and a
workspace admin.

---------

Error when the deploying user is a workspace admin but not a metastore
admin:
```
Error: terraform apply: exit status 1

Error: cannot update permissions: User is not a metastore admin for Metastore 'deco-uc-prod-aws-us-east-1'.

  with databricks_permissions.pipeline_foo,
  on bundle.tf.json line 23, in resource.databricks_permissions.pipeline_foo:
  23:       }
```

--------

Output of bundle validate:
```
➜  bundle-playground git:(master) ✗ cli bundle validate
Warning: You are using the legacy mode of run_as. The support for this mode is experimental and might be removed in a future release of the CLI. In order to run the DLT pipelines in your DAB as the run_as user this mode changes the owners of the pipelines to the run_as identity, which requires the user deploying the bundle to be a workspace admin, and also a Metastore admin if the pipeline target is in UC.
  at experimental.use_legacy_run_as
  in databricks.yml:13:22

Name: bundle-playground
Target: default
Workspace:
  Host: https://dbc-a39a1eb1-ef95.cloud.databricks.com
  User: shreyas.goenka@databricks.com
  Path: /Users/shreyas.goenka@databricks.com/.bundle/bundle-playground/default

Found 1 warning
```
2024-04-22 11:51:41 +00:00
..
generate Added `bundle generate pipeline` command (#1139) 2024-01-25 11:35:14 +00:00
loader Return diagnostics from `config.Load` (#1324) 2024-03-28 10:59:03 +00:00
mutator Add legacy option for `run_as` (#1384) 2024-04-22 11:51:41 +00:00
paths Use dynamic configuration model in bundles (#1098) 2024-02-16 19:41:58 +00:00
resources Use dynamic configuration model in bundles (#1098) 2024-02-16 19:41:58 +00:00
testdata First look for databricks.yml before falling back to bundle.yml (#580) 2023-07-18 12:16:34 +02:00
validate Added validate mutator to surface additional bundle warnings (#1352) 2024-04-18 15:13:16 +00:00
variable Return `application_id` for service principal lookups (#1245) 2024-03-04 16:12:10 +00:00
artifact.go Use dynamic configuration model in bundles (#1098) 2024-02-16 19:41:58 +00:00
artifacts_test.go Added exec.NewCommandExecutor to execute commands with correct interpreter (#1075) 2023-12-21 15:45:23 +00:00
bundle.go Allow specifying CLI version constraints required to run the bundle (#1320) 2024-04-02 12:55:21 +00:00
deployment.go Disable locking for development mode (#1302) 2024-04-18 01:59:39 +00:00
experimental.go Add legacy option for `run_as` (#1384) 2024-04-22 11:51:41 +00:00
filename.go Move bundle configuration filename code (#917) 2023-10-25 09:54:39 +00:00
filename_test.go Move bundle configuration filename code (#917) 2023-10-25 09:54:39 +00:00
git.go Use dynamic configuration model in bundles (#1098) 2024-02-16 19:41:58 +00:00
lock.go Disable locking for development mode (#1302) 2024-04-18 01:59:39 +00:00
lock_test.go Acquire lock prior to deploy (#270) 2023-03-22 16:37:26 +01:00
resources.go Use dynamic configuration model in bundles (#1098) 2024-02-16 19:41:58 +00:00
resources_test.go Support Unity Catalog Registered Models in bundles (#846) 2023-10-16 15:32:49 +00:00
root.go Added validate mutator to surface additional bundle warnings (#1352) 2024-04-18 15:13:16 +00:00
root_test.go Return diagnostics from `config.Load` (#1324) 2024-03-28 10:59:03 +00:00
sync.go Use dynamic configuration model in bundles (#1098) 2024-02-16 19:41:58 +00:00
target.go Use dynamic configuration model in bundles (#1098) 2024-02-16 19:41:58 +00:00
workspace.go Added `auth describe` command (#1244) 2024-04-03 08:14:04 +00:00
workspace_test.go Resolve configuration before performing verification (#890) 2023-10-20 13:10:31 +00:00