fix(sql): set resource identity before early-return in resourceSqlUserRead for stopped instances - #18644
Open
vr-ibm wants to merge 2 commits into
Open
Conversation
…topped instances When a Cloud SQL instance has ActivationPolicy != ALWAYS (stopped/paused), resourceSqlUserRead returns early before SetResourceIdentityAttributes is called. This causes 'Missing Resource Identity After Read' errors for users upgrading to 7.42+ with existing state from older provider versions. Fix: call SetResourceIdentityAttributes using values already in scope (project, instance, host, name) before the early-return so identity is always populated regardless of instance activation policy. Also strengthens TestAccSqlUser_instanceWithActivationPolicy to assert identity attributes are set after reading a stopped instance, and adds an ImportState step to verify identity survives a full import round-trip. Fixes hashicorp/terraform-provider-google#28571
Collaborator
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit ef3f88c: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode 🟢 All tests passed in Replaying mode! No Recording was needed. View the replaying VCR build log |
Collaborator
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit ad1e45c: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode 🟢 All tests passed in Replaying mode! No Recording was needed. View the replaying VCR build log |
vr-ibm
marked this pull request as ready for review
August 14, 2026 18:19
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.
Fixes hashicorp/terraform-provider-google#28571
When a Cloud SQL instance has
ActivationPolicy != ALWAYS(stopped/paused),resourceSqlUserReadreturns early beforeSetResourceIdentityAttributesis called. Users upgrading to provider ≥7.42 with existing state seeMissing Resource Identity After Readon every plan.Fix
Call
SetResourceIdentityAttributesusingproject,instance,host, andname(already in scope fromd.Getabove) immediately before the early-return. The existing call later in the function is untouched.Test
Strengthened
TestAccSqlUser_instanceWithActivationPolicyto assert identity attributes survive a read and import round-trip while the instance is stopped.