Skip to content

Add support for default_workspace_id - #5284

Open
Divyansh-db wants to merge 2 commits into
mainfrom
divyansh-vijayvergia_data/default_workspace_id_support
Open

Add support for default_workspace_id#5284
Divyansh-db wants to merge 2 commits into
mainfrom
divyansh-vijayvergia_data/default_workspace_id_support

Conversation

@Divyansh-db

@Divyansh-db Divyansh-db commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

Changes

Added support for default workspace ID in plugin framework and sdkv2 configure methods. A new defaultWorkspaceID field is a part of DatabricksClient.

Tests

Unit test.

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • using Go SDK
  • using TF Plugin Framework
  • has entry in NEXT_CHANGELOG.md file

@Divyansh-db
Divyansh-db requested review from a team as code owners December 17, 2025 09:11
@Divyansh-db
Divyansh-db force-pushed the divyansh-vijayvergia_data/default_workspace_id_support branch from f30f724 to d486bb5 Compare December 17, 2025 09:14
@Divyansh-db
Divyansh-db removed request for a team December 17, 2025 09:15
@github-actions

Copy link
Copy Markdown
Contributor

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/terraform

Inputs:

  • PR number: 5284
  • Commit SHA: 8dd7a34673f9c90ac3be688e3c8dd753f299e226

Checks will be approved automatically on success.

@tanmay-db tanmay-db left a comment

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.

Left some comments. Could you confirm if this works E2E manually on jobs resource. Also we would need to update the provider documentation. See: https://registry.terraform.io/providers/databricks/databricks/latest/docs#argument-reference

Comment thread common/client.go
Comment on lines +81 to +85
// defaultWorkspaceID is the default workspace ID to use when workspace_id is not
// specified in provider_config at the resource level. This is set from the provider
// configuration and serves as a fallback for unified provider resources.
defaultWorkspaceID string

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.

Note: These changes would need to be done upstream as this file is generated.

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 will add it to the generated file template

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.

Follow up PR - can you add a header to all autogenerated files and then add claude.md that will parse that and know what to do? Make sure the claude.md doesn't leak internal details, draft it from the perspective of somebody using claude from outside databricks

Comment on lines +324 to +339
// Add default_workspace_id for unified provider support
ps["default_workspace_id"] = &schema.Schema{
Type: schema.TypeString,
Optional: true,
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
v := val.(string)
if v == "" {
return
}
if !regexp.MustCompile(`^[1-9]\d*$`).MatchString(v) {
errs = append(errs, fmt.Errorf("default_workspace_id must be a positive integer without leading zeros"))
}
return
},
Description: "Default workspace ID to use when workspace_id is not specified in provider_config at the resource level",
}

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.

Do we need to add this separately or can this be part of ConfigAttributes like it's done for all the other attributes. See line above 316

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.

ConfigAttributes come from config in Go SDK. default_workspace_id only makes sense in the context of terraform provider so in my opinion, it should not be the part of Go SDK config.

Comment thread NEXT_CHANGELOG.md

### New Features and Improvements

* Add support for `default_workspace_id` provider-level configuration ([#5284](https://github.com/databricks/terraform-provider-databricks/pull/5284)).

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.

This is not a great changelog comment as is. There are so many caveats about how and where this works (how your provider is configured, what the host is, which resource you're using, etc) that as a stand along single sentence this is confusing at best. TBH I would leave this out of the changelog entirely since it's still pretty 1/2 baked at this point or add more details like "experimental support for .... " or something like that.

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