Skip to content

Conversation

@denik
Copy link
Contributor

@denik denik commented Feb 2, 2026

Changes

If field is in recreate_on_changes resource setting then we assume it does not change unless the resource is recreated and can resolve it before deploying the resource (like we do with "id" field).

Why

More precise plan. In some cases this can downgrade 'recreate' to 'update' or 'update' to 'skip'.

Tests

New regression test.

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

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

Very nice.

This will make it possible to refer to the name field for the postgres resources.

@@ -0,0 +1,3 @@
trace $CLI bundle deploy
trace update_file.py databricks.yml "comment1" "comment2"
trace $CLI bundle plan | contains.py '1 to change, 0 to delete, 2 unchanged'
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment explaining what you expect.

I think I can trace this to expecting the update for the volume to not trigger an update for the job.

return a.resourceConfig
}

func (a *Adapter) IsImmutableField(path *structpath.PathNode) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

This can use a comment.

The "immutability" test is conditional on the resource not being recreated.

It's not clear what the path is that's being referred to, is it a path in the remote state or the "comparable state". I suspect we're dealing with the comparable state only, because of the reference to "recreate on changes".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not clear what the path is that's being referred to, is it a path in the remote state or the "comparable state". > I suspect we're dealing with the comparable state only, because of the reference to "recreate on changes".

Good question.

The end goal is to have "comparable state" be a subset of "remote state". As such, any path that works for comparable state would work for remote state as well. (This is not the case for some resources, but it'll be fixed and enforced).

I'm not sure if there is a use case for field that is both
a) present only in remote state but not in local state
b) immutable

I'll rename the method to IsFieldInRecreateOnChanges() because that's less ambiguous.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is one for the Postgres APIs: https://docs.databricks.com/api/workspace/postgres/getproject

The "name" field is even annotated as "immutable". It cannot be set by the client.

Copy link
Contributor Author

@denik denik Feb 2, 2026

Choose a reason for hiding this comment

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

Good example. Let's address that in a follow up. I think we should have immutable resource config entry (with similar effect as recreate_on_changes with respect to this change).

@denik denik temporarily deployed to test-trigger-is February 2, 2026 10:31 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is February 2, 2026 10:32 — with GitHub Actions Inactive
@denik denik requested a review from pietern February 2, 2026 10:32
@denik denik added this pull request to the merge queue Feb 2, 2026
Merged via the queue into main with commit 0840a20 Feb 2, 2026
18 checks passed
@denik denik deleted the denik/immutable-fields2 branch February 2, 2026 11:50
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.

4 participants