Open minico-dev opened 1 year ago
We are using the databricks bundle to deploy and seeing this same behavior. The state has the correct run_as value, but it is never set on the job itself.
I did some testing and it doesn't look like the provider is wrong best I can tell, but the create api isn't respecting the passed values. I am able to use CLI to do a partial update on the job after the fact and it took the value as expected. I need to test creating a job with the api using CLI to see if it is the provider or API at fault.
databricks api post /api/2.1/jobs/update --json "{\"job_id\":\"12345657890\",\"new_settings\":{\"run_as\":{\"service_principal_name\":\"c14d4ea0-421c-4720-8794-c146747f8471\"}}}"
Good morning, I discovered this morning that this is resolved (or at least worked around) by adding a databricks_permissions
resource to assign the user as owner of the job.
Configuration
Expected Behavior
I created the Databricks Job by letting an Azure Service Principal apply the Terraform configuration. When I first created the resource I omitted the
run_as
block. Later I added it with theuser_name
set to a static user because of this product issue. I expect the job'srun_as
to be changed from the Service Principal that created the job to the user I specified.Actual Behavior
During
terraform plan
andterraform apply
, the change is prompted as I expected. I can see Terraform plans to change the value ofrun_as
from the SP to the user. Theterraform apply
command states that modifications were successful, and the command finishes without errors. However, when checking the Databricks Workspace, the value is not changed at all, and still contains the SP. Also, upon inspecting the State file, the value is still set to the SP. When I completely remove the Job and recreate it using exactly the same specification (with theuser_name
set), the job'srun_as
parameter is correctly set to the user.Steps to Reproduce
terraform apply
adatabricks_job
resource without therun_as
block present in the specification, using a Service Principalrun_as
parameter to a specific userterraform apply
, see that Terraform states that the modification was successful, while in fact is wasn'tTerraform and provider versions
Terraform 1.5.7 Databricks 1.26.0