Add provider level workspace id support for migrated resources#5582
Open
Divyansh-db wants to merge 4 commits intodivyansh-vijayvergia_data/dwsid-sdkv2-go-sdkfrom
Open
Add provider level workspace id support for migrated resources#5582Divyansh-db wants to merge 4 commits intodivyansh-vijayvergia_data/dwsid-sdkv2-go-sdkfrom
Divyansh-db wants to merge 4 commits intodivyansh-vijayvergia_data/dwsid-sdkv2-go-sdkfrom
Conversation
…d resources to enable bi directional migration
Contributor
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Details
Why types.Object instead of types.List?
provider_config with types.List + Namespace_SdkV2 was the original SDKv2-compatible approach, but it caused a perpetual diff: Terraform Core's proposedNewBlock logic for ListNestedBlock does not preserve prior state when config is absent, forcing a diff on every plan. types.Object + SingleNestedAttribute with Optional+Computed avoids this because TC's optionalValueNotComputable preserves the attribute from prior state when all children are Computed.
Why skip SingleNestedAttributeBuilder in convertAttributesToBlocks?
SingleNestedAttributeBuilder implements Blockable but its ToBlock() panics — types.Object has no SDKv2 block equivalent. The skip ensures SDKv2-migrated resources that embed Namespace (types.Object) can call ConfigureAsSdkV2Compatible() without crashing. The ConfigureProviderConfig() helper then applies the required Optional+Computed flags and ProviderConfigPlanModifier after the SdkV2-compat conversion.
Why no state upgrader for bidirectional migration?
The migrated resources never had provider_config in their original SDKv2 implementations — common.Namespace support is added per-resource, and these resources were migrated to PF before it existed. By keeping both SDKv2 and PF at schema version 0 (the Go default), the framework's passthrough path (IgnoreUndefinedAttributes: true) handles both directions transparently:
This allows users to freely switch between SDKv2 (USE_SDK_V2_RESOURCES) and PF without state manipulation.
Test plan
NO_CHANGELOG=true