From cf2a1c38ba8ba7d51ed583171b8bf7b6886b5084 Mon Sep 17 00:00:00 2001 From: shreyas-goenka <88374338+shreyas-goenka@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:52:04 +0530 Subject: [PATCH] Set run_as permissions after variable interpolation (#1141) ## Changes This PR sets run as permissions after variable interpolation. Terraform does not allow specifying permissions for current user. The following configuration would fail becuase we would assign a permission block for self, bypassing this check here: https://github.com/databricks/cli/blob/4ee926b8858bf1583fcd8bbe9a5222b1594e72ec/bundle/config/mutator/run_as.go#L47 ``` run_as: user_name: ${workspace.current_user.userName} ``` ## Tests Manually, setting run_as to ${workspace.current_user.userName} works now --- bundle/phases/initialize.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle/phases/initialize.go b/bundle/phases/initialize.go index f65289e1..e0558d93 100644 --- a/bundle/phases/initialize.go +++ b/bundle/phases/initialize.go @@ -22,7 +22,6 @@ func Initialize() bundle.Mutator { []bundle.Mutator{ mutator.InitializeWorkspaceClient(), mutator.PopulateCurrentUser(), - mutator.SetRunAs(), mutator.DefineDefaultWorkspaceRoot(), mutator.ExpandWorkspaceRoot(), mutator.DefineDefaultWorkspacePaths(), @@ -33,6 +32,7 @@ func Initialize() bundle.Mutator { interpolation.IncludeLookupsInPath("workspace"), interpolation.IncludeLookupsInPath(variable.VariableReferencePrefix), ), + mutator.SetRunAs(), mutator.OverrideCompute(), mutator.ProcessTargetMode(), mutator.ExpandPipelineGlobPaths(),