You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Fix] Fix metastore ID interpolation for account-level storage credential imports (#4980)
## Changes
When importing account-level storage credentials, the metastore ID was
not being interpolated correctly, causing API calls to fail with
malformed URLs containing double slashes
(`/api/2.0/accounts/.../metastores//storage-credentials/...`). This
occurred because during import, the Terraform state is empty and
`d.Get("metastore_id")` returned an empty string.
Added a `parseStorageCredentialId()` function that handles composite IDs
in the format `metastore_id|storage_credential_name` for account-level
imports, extracting the metastore ID and setting it in the state before
making API calls. This maintains backward compatibility with
workspace-level imports using simple credential names and includes
comprehensive unit tests and updated documentation.
## Tests
- [x] `make test` run locally
- [x] relevant change in `docs/` folder
- [ ] covered with integration tests in `internal/acceptance`
- [x] using Go SDK
- [ ] using TF Plugin Framework
- [x] has entry in `NEXT_CHANGELOG.md` file
Fixes: ES-1561726
---------
Co-authored-by: Claude <[email protected]>
Co-authored-by: Omer Lachish <[email protected]>
Co-authored-by: Alex Ott <[email protected]>
Co-authored-by: Omer Lachish <[email protected]>
Co-authored-by: vuong-nguyen <[email protected]>
Co-authored-by: Alex Ott <[email protected]>
Copy file name to clipboardExpand all lines: NEXT_CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@
14
14
* Correct which file event fields should be reset in `databricks_external_location` ([#4945](https://github.com/databricks/terraform-provider-databricks/pull/4945))
15
15
* Fix `ExactlyOneOf` in `databricks_app` ([#4946](https://github.com/databricks/terraform-provider-databricks/pull/4946))
16
16
* Enable update of `databricks_mws_ncc_private_endpoint_rule` resource ([#4957](https://github.com/databricks/terraform-provider-databricks/pull/4957))
17
+
* Fix metastore ID interpolation for account-level storage credential imports ([#4980](https://github.com/databricks/terraform-provider-databricks/pull/4980)). Storage credentials can now be imported using two formats: `<storage_credential_name>` when using a workspace-level provider, and `<metastore_id>|<storage_credential_name>` when using an account-level provider. Previously, importing storage credentials with an account-level provider would fail due to missing metastore ID in the API call.
0 commit comments