diff --git a/mmv1/third_party/terraform/resources/resource_sql_user.go b/mmv1/third_party/terraform/resources/resource_sql_user.go index ddc41d541780..17659f103761 100644 --- a/mmv1/third_party/terraform/resources/resource_sql_user.go +++ b/mmv1/third_party/terraform/resources/resource_sql_user.go @@ -186,9 +186,15 @@ func resourceSqlUserRead(d *schema.ResourceData, meta interface{}) error { } var user *sqladmin.User - for _, currentUser := range users.Items { + databaseInstance, err := config.NewSqlAdminClient(userAgent).Instances.Get(project, instance).Do() + if err != nil { + return err + } - name = strings.Split(name, "@")[0] + for _, currentUser := range users.Items { + if !strings.Contains(databaseInstance.DatabaseVersion, "POSTGRES") { + name = strings.Split(name, "@")[0] + } if currentUser.Name == name { // Host can only be empty for postgres instances,