Skip to content

Commit

Permalink
fix overwriting of name field for IAM Group user in resourceSqlUser…
Browse files Browse the repository at this point in the history
…Read method (#11466)
  • Loading branch information
pratikgarg10 authored Aug 22, 2024
1 parent 55fec56 commit 879ae52
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mmv1/third_party/terraform/services/sql/resource_sql_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,13 @@ func resourceSqlUserRead(d *schema.ResourceData, meta interface{}) error {
}

for _, currentUser := range users.Items {
var username string
if !(strings.Contains(databaseInstance.DatabaseVersion, "POSTGRES") || currentUser.Type == "CLOUD_IAM_GROUP") {
name = strings.Split(name, "@")[0]
username = strings.Split(name, "@")[0]
} else {
username = name
}
if currentUser.Name == name {
if currentUser.Name == username {
// Host can only be empty for postgres instances,
// so don't compare the host if the API host is empty.
if host == "" || currentUser.Host == host {
Expand Down

0 comments on commit 879ae52

Please sign in to comment.