fix: resolve perpetual Terraform plan diffs for workspace_profile and data_sources#176
Merged
d-bytebase merged 2 commits intomainfrom Mar 25, 2026
Merged
fix: resolve perpetual Terraform plan diffs for workspace_profile and data_sources#176d-bytebase merged 2 commits intomainfrom
d-bytebase merged 2 commits intomainfrom
Conversation
…petual diff Fields like sql_result_size, query_timeout_in_seconds, password_restriction, external_url, and token duration fields are server-managed with defaults. Without Computed, Terraform plans to null them when absent from HCL, but the update never sends the change (field mask excludes them), causing a perpetual diff. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The API returns redisType: STANDALONE for all data sources regardless of engine. The flatten function wrote this to state, changing the TypeSet hash vs the config-side hash (which lacks redis_type for non-Redis instances). Guard redis-specific fields behind an engine check so they only appear in state for Redis instances. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ecmadao
approved these changes
Mar 25, 2026
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
bytebase_setting.workspace_profileperpetual-> nulldiff by marking server-managed optional fields asComputedbytebase_instance.data_sourcesperpetual remove/add diff by guarding Redis-specific fields behind engine type check in flattenProblem
workspace_profile: Fields like
sql_result_size,query_timeout_in_seconds, andpassword_restrictionare server-managed with defaults. The read function writes server values to state, but the update only patches fields present in HCL (via field masks). WithoutComputed, Terraform plans to null them when absent from config, but apply never sends the change — causing a perpetual diff.data_sources: The API returns
redisType: STANDALONEfor all data sources regardless of engine type. The flatten function wrote this to state, changing the TypeSet hash vs the config-side hash (which lacksredis_typefor non-Redis instances), causing perpetual remove/add churn.Test plan
terraform planafterterraform applygo buildcompiles cleanly🤖 Generated with Claude Code