Skip to content

Commit 879ae52

Browse files
authored
fix overwriting of name field for IAM Group user in resourceSqlUserRead method (#11466)
1 parent 55fec56 commit 879ae52

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mmv1/third_party/terraform/services/sql/resource_sql_user.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,13 @@ func resourceSqlUserRead(d *schema.ResourceData, meta interface{}) error {
348348
}
349349

350350
for _, currentUser := range users.Items {
351+
var username string
351352
if !(strings.Contains(databaseInstance.DatabaseVersion, "POSTGRES") || currentUser.Type == "CLOUD_IAM_GROUP") {
352-
name = strings.Split(name, "@")[0]
353+
username = strings.Split(name, "@")[0]
354+
} else {
355+
username = name
353356
}
354-
if currentUser.Name == name {
357+
if currentUser.Name == username {
355358
// Host can only be empty for postgres instances,
356359
// so don't compare the host if the API host is empty.
357360
if host == "" || currentUser.Host == host {

0 commit comments

Comments
 (0)