Skip to content

Configure __apply_policy_default_values_allow_list for task and job clusters - #3255

Merged
andrewnester merged 6 commits into
mainfrom
apply-policy-default-values
Jul 16, 2025
Merged

Configure __apply_policy_default_values_allow_list for task and job clusters#3255
andrewnester merged 6 commits into
mainfrom
apply-policy-default-values

Conversation

@pietern

@pieternpietern commented Jul 15, 2025

Copy link
Copy Markdown
Contributor

Changes

Automatically reapply cluster policy defaults for task and job clusters when updating existing jobs.

Note: if you relied on task and job cluster settings that originate from a cluster policy not changing on deploy, even though the cluster policy defaults they were drawn from did change, then you'll need to explicitly include those values in your bundle configuration from now on.

Why

The latest version of the Terraform provider comes with a feature specifically for re-applying cluster policy defaults for task and job clusters when updating a job (databricks/terraform-provider-databricks#4834). Before this change, it was not possible to reapply cluster policy defaults for an existing job, as Terraform keeps server-side default values in its state. Users had to destroy and recreate jobs for new defaults to take effect.

With the Terraform dependency in DABs, the same happened for DABs users, and cluster policy defaults were effectively "snapshotted" on the first deploy, and never updated thereafter.

This is contrary to the behavior we expect to see. Unless a field is explicitly configured in the bundle configuration, cluster policy defaults should be applied on every deploy, regardless of the job being created or updated.

This change passes the list of fields explicitly specified in the bundle configuration to Terraform via the __allow_policy_default_values_allow_list property introduced in the linked PR.

Tests

  • Unit tests pass.
  • Manually confirmed that when the cluster policy for a job cluster is changed, the fields that aren't explicitly specified in the bundle configuration draw their default values from the new cluster policy.

@pietern
pieterntemporarily deployed to test-trigger-is July 15, 2025 09:02 — with GitHub Actions Inactive
@pietern
pieterntemporarily deployed to test-trigger-is July 15, 2025 09:29 — with GitHub Actions Inactive
@pietern
pieterntemporarily deployed to test-trigger-is July 15, 2025 14:29 — with GitHub Actions Inactive
@pietern
pietern marked this pull request as ready for review July 15, 2025 14:29

// If the field "policy_id" is not set, do nothing.
if _, ok := v.Get("policy_id").AsString(); !ok {
return v, nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it worth to log a warning here because apply_policy_default_values is set but not policy_id?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks for flagging. I think not because it doesn't make sense to use one without the other.

Any validation for a condition like this we should apply earlier, as it will apply to either deployment backend. The stuff here is really TF specific to work around the issue.

@pietern
pieterntemporarily deployed to test-trigger-is July 16, 2025 10:33 — with GitHub Actions Inactive
@pietern
pietern enabled auto-merge July 16, 2025 10:37
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jul 16, 2025

Copy link
Copy Markdown
Collaborator

Run: 16317148650

Env✅‌pass🔄‌flaky🙈‌skip
🔄‌aws linux29111424
🔄‌aws windows29013423
🔄‌aws-ucws linux4053324
🔄‌aws-ucws windows4063323
✅‌azure linux302423
✅‌azure windows303422
✅‌azure-ucws linux410321
✅‌azure-ucws windows411320
✅‌gcp linux301425
🔄‌gcp windows2993424
23 failing tests:
Test Nameaws linuxaws windowsaws-ucws linuxaws-ucws windowsgcp windows
TestAccept✅‌pass✅‌pass🔄‌flaky🔄‌flaky✅‌pass
TestAccept/bundle/deploy/dashboard/simple_outside_bundle_root✅‌pass🔄‌flaky✅‌pass✅‌pass✅‌pass
TestAccept/bundle/deploy/pipeline/auto-approve✅‌pass🔄‌flaky✅‌pass✅‌pass✅‌pass
TestAccept/bundle/deploy/pipeline/auto-approve/DATABRICKS_CLI_DEPLOYMENT=direct-exp✅‌pass🔄‌flaky✅‌pass✅‌pass✅‌pass
TestAccept/bundle/resources/pipelines✅‌pass🔄‌flaky🔄‌flaky🔄‌flaky✅‌pass
TestAccept/bundle/resources/pipelines/DATABRICKS_CLI_DEPLOYMENT=direct-exp🔄‌flaky✅‌pass✅‌pass✅‌pass🔄‌flaky
TestAccept/bundle/resources/pipelines/DATABRICKS_CLI_DEPLOYMENT=terraform🔄‌flaky🔄‌flaky🔄‌flaky🔄‌flaky🔄‌flaky
TestAccept/bundle/templates/default-python/combinations/classic/DATABRICKS_CLI_DEPLOYMENT=direct-exp/DLT=yes/NBOOK=yes/PY=yes✅‌pass🔄‌flaky✅‌pass✅‌pass✅‌pass
TestAccept/bundle/templates/default-python/combinations/classic/DATABRICKS_CLI_DEPLOYMENT=terraform/DLT=yes/NBOOK=yes/PY=yes✅‌pass🔄‌flaky✅‌pass✅‌pass✅‌pass
TestAccept/bundle/templates/default-python/combinations/serverless✅‌pass✅‌pass✅‌pass✅‌pass🔄‌flaky
TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_CLI_DEPLOYMENT=direct-exp/UV_PYTHON=3.12🔄‌flaky✅‌pass✅‌pass✅‌pass✅‌pass
TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_CLI_DEPLOYMENT=direct-exp/UV_PYTHON=3.13🔄‌flaky✅‌pass✅‌pass✅‌pass✅‌pass
TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_CLI_DEPLOYMENT=direct-exp/UV_PYTHON=3.9🔄‌flaky✅‌pass✅‌pass✅‌pass✅‌pass
TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_CLI_DEPLOYMENT=terraform/UV_PYTHON=3.9🔄‌flaky✅‌pass✅‌pass✅‌pass✅‌pass
TestAccept/selftest/record_cloud/workspace-file-io🔄‌flaky🔄‌flaky✅‌pass✅‌pass✅‌pass
TestAccept/selftest/record_cloud/workspace-file-io/DATABRICKS_CLI_DEPLOYMENT=direct-exp✅‌pass🔄‌flaky✅‌pass✅‌pass✅‌pass
TestAccept/selftest/record_cloud/workspace-file-io/DATABRICKS_CLI_DEPLOYMENT=terraform🔄‌flaky✅‌pass✅‌pass✅‌pass✅‌pass
TestFetchRepositoryInfoAPI_FromRepo🔄‌flaky🔄‌flaky✅‌pass✅‌pass✅‌pass
TestImportDirDoesNotOverwrite✅‌pass🔄‌flaky✅‌pass✅‌pass✅‌pass
TestSyncEnsureRemotePathIsUsableIfRepoExists🔄‌flaky✅‌pass✅‌pass✅‌pass✅‌pass
TestSyncNestedFolderSync🔄‌flaky✅‌pass✅‌pass✅‌pass✅‌pass
TestWorkspaceFilesExtensions_ExportFormatIsPreserved✅‌pass🔄‌flaky✅‌pass✅‌pass✅‌pass
TestWorkspaceFilesExtensions_ExportFormatIsPreserved/source_python✅‌pass🔄‌flaky✅‌pass✅‌pass✅‌pass

@pietern
pietern added this pull request to the merge queueJul 16, 2025
auto-merge was automatically disabled July 16, 2025 12:23

Pull request was closed

@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to a manual request Jul 16, 2025
@andrewnester
andrewnester added this pull request to the merge queueJul 16, 2025
github-actionsBot pushed a commit that referenced this pull request Jul 16, 2025
## Changes
Upgrade TF provider to 1.85.0
Important changes:
* Added support for `database` resource for Apps
* Includes a change needed for enabling `allow_policy_default_values`
fix#3255
## Tests
Existing tests pass
<!-- If your PR needs to be included in the release notes for next
release,
add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
Merged via the queue into main with commit 6c9e3d6Jul 16, 2025
14 checks passed
@andrewnester
andrewnester deleted the apply-policy-default-values branch July 16, 2025 12:43
deco-sdk-taggingBot added a commit that referenced this pull request Jul 16, 2025
## Release v0.260.0
### Notable Changes
* Added support for creating SQL warehouses in DABs ([#3129](#3129))
### Dependency updates
* Upgrade Go SDK to 0.75.0 ([#3256](#3256))
### CLI
* Add `databricks psql` command to connect to Lakebase with a single command ([#3128](#3128))
### Bundles
* Jobs that use cluster policy default values for their cluster configuration now correctly update those defaults on every deployment ([#3255](#3255)).
* Add upper and lower helper methods for bundle templates ([#3242](#3242))
denik pushed a commit that referenced this pull request May 20, 2026
## Changes
Upgrade TF provider to 1.85.0
Important changes:
* Added support for `database` resource for Apps
* Includes a change needed for enabling `allow_policy_default_values`
fix#3255
## Tests
Existing tests pass
<!-- If your PR needs to be included in the release notes for next
release,
add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
denik pushed a commit that referenced this pull request May 20, 2026
… clusters (#3255)
## Changes
Automatically reapply cluster policy defaults for task and job clusters
when updating existing jobs.
Note: if you relied on task and job cluster settings that originate from
a cluster policy _not_ changing on deploy, even though the cluster
policy defaults they were drawn from did change, then you'll need to
explicitly include those values in your bundle configuration from now
on.
## Why
The latest version of the Terraform provider comes with a feature
specifically for re-applying cluster policy defaults for task and job
clusters when updating a job
(databricks/terraform-provider-databricks#4834).
Before this change, it was not possible to reapply cluster policy
defaults for an existing job, as Terraform keeps server-side default
values in its state. Users had to destroy and recreate jobs for new
defaults to take effect.
With the Terraform dependency in DABs, the same happened for DABs users,
and cluster policy defaults were effectively "snapshotted" on the first
deploy, and never updated thereafter.
This is contrary to the behavior we expect to see. Unless a field is
explicitly configured in the bundle configuration, cluster policy
defaults should be applied on every deploy, regardless of the job being
created or updated.
This change passes the list of fields explicitly specified in the bundle
configuration to Terraform via the
`__allow_policy_default_values_allow_list` property introduced in the
linked PR.
## Tests
* Unit tests pass.
* Manually confirmed that when the cluster policy for a job cluster is
changed, the fields that aren't explicitly specified in the bundle
configuration draw their default values from the new cluster policy.
<!-- If your PR needs to be included in the release notes for next
release,
add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
denik pushed a commit that referenced this pull request May 20, 2026
## Release v0.260.0
### Notable Changes
* Added support for creating SQL warehouses in DABs ([#3129](#3129))
### Dependency updates
* Upgrade Go SDK to 0.75.0 ([#3256](#3256))
### CLI
* Add `databricks psql` command to connect to Lakebase with a single command ([#3128](#3128))
### Bundles
* Jobs that use cluster policy default values for their cluster configuration now correctly update those defaults on every deployment ([#3255](#3255)).
* Add upper and lower helper methods for bundle templates ([#3242](#3242))
Sign up for freeto 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

@pietern@eng-dev-ecosystem-bot@andrewnester