Skip to content

direct: Fix spurious recreate of external volumes with trailing-slash storage_location#5145

Merged
denik merged 6 commits into
mainfrom
denik/volumes-trailing-slash
Apr 30, 2026
Merged

direct: Fix spurious recreate of external volumes with trailing-slash storage_location#5145
denik merged 6 commits into
mainfrom
denik/volumes-trailing-slash

Conversation

@denik

@denik denik commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

The UC API strips trailing slashes from storage_location on create, causing the direct engine to detect drift on every subsequent plan and trigger a full delete+create cycle.

Fix: add OverrideChangeDesc to ResourceVolume that treats storage_location values differing only by trailing slashes as equivalent (alias), matching the Terraform provider's suppressLocationDiff behavior.

Also update the testserver to accept storage_location on EXTERNAL volumes and strip the trailing slash, mirroring UC API behavior so the bug and fix are reproducible locally. Add an invariant no_drift test for external volumes.

Co-authored-by: Isaac

@denik denik temporarily deployed to test-trigger-is April 30, 2026 11:07 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 30, 2026 11:07 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 30, 2026 11:21 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 30, 2026 11:21 — with GitHub Actions Inactive
return nil
}

if newStr != remoteStr && strings.TrimRight(newStr, "/") == strings.TrimRight(remoteStr, "/") {

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.

Shall we store the storage_location in the state without the slash instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, state is tracking the config. If user has slash in the config, we do that as well.

Normalized comparison is more explicit.

@denik denik temporarily deployed to test-trigger-is April 30, 2026 11:38 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 30, 2026 11:38 — with GitHub Actions Inactive
catalog_name: main
schema_name: default
volume_type: EXTERNAL
storage_location: s3://test-bucket/path/

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.

consider multiple / as suffix to ensure TrimRight does the expected thing

denik added 4 commits April 30, 2026 14:01
…_location

The UC API strips trailing slashes from storage_location on create, causing
the direct engine to detect drift on every subsequent plan and trigger a
full delete+create cycle.

Fix: add OverrideChangeDesc to ResourceVolume that treats storage_location
values differing only by trailing slashes as equivalent (alias), matching
the Terraform provider's suppressLocationDiff behavior.

Also update the testserver to accept storage_location on EXTERNAL volumes
and strip the trailing slash, mirroring UC API behavior so the bug and fix
are reproducible locally. Add an invariant no_drift test for external volumes.

Co-authored-by: Isaac
@denik denik force-pushed the denik/volumes-trailing-slash branch from f6d367a to 0ded0ac Compare April 30, 2026 12:02
@denik denik temporarily deployed to test-trigger-is April 30, 2026 12:02 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 30, 2026 12:02 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 30, 2026 12:03 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 30, 2026 12:03 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 30, 2026 12:06 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 30, 2026 12:06 — with GitHub Actions Inactive
@denik denik enabled auto-merge April 30, 2026 12:06
@denik denik disabled auto-merge April 30, 2026 12:25
@denik denik merged commit d795f40 into main Apr 30, 2026
22 of 23 checks passed
@denik denik deleted the denik/volumes-trailing-slash branch April 30, 2026 12:25
denik added a commit that referenced this pull request May 20, 2026
… storage_location (#5145)

The UC API strips trailing slashes from storage_location on create,
causing the direct engine to detect drift on every subsequent plan and
trigger a full delete+create cycle.

Fix: add OverrideChangeDesc to ResourceVolume that treats
storage_location values differing only by trailing slashes as equivalent
(alias), matching the Terraform provider's suppressLocationDiff
behavior.

Also update the testserver to accept storage_location on EXTERNAL
volumes and strip the trailing slash, mirroring UC API behavior so the
bug and fix are reproducible locally. Add an invariant no_drift test for
external volumes.

Co-authored-by: Isaac
denik added a commit that referenced this pull request Jun 10, 2026
…names (#5531)

The direct engine saves local config to state, so when Unity Catalog
lowercases a schema/volume identifier, the next deploy sees the original
mixed-case value drift against the normalized remote value and
recreates/renames the resource — on every second deploy with no config
changes. This PR fixes that.

The fix is expressed declaratively via a new `resources.yml` key,
`normalize_case`. The same mechanism also absorbs the existing
trailing-slash `storage_location` suppression (#5145) as a second key,
`normalize_slash` — a refactor of behavior that already lived in
per-resource `OverrideChangeDesc` methods, not a new behavior.
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.

3 participants