Add support for default_workspace_id - #5284
Conversation
f30f724 to
d486bb5
Compare
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
tanmay-db
left a comment
There was a problem hiding this comment.
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
| // 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 | ||
|
|
There was a problem hiding this comment.
Note: These changes would need to be done upstream as this file is generated.
There was a problem hiding this comment.
I will add it to the generated file template
There was a problem hiding this comment.
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
| // 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", | ||
| } |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
|
|
||
| ### New Features and Improvements | ||
|
|
||
| * Add support for `default_workspace_id` provider-level configuration ([#5284](https://github.com/databricks/terraform-provider-databricks/pull/5284)). |
There was a problem hiding this comment.
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.
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 testrun locallydocs/folderinternal/acceptanceNEXT_CHANGELOG.mdfile