Skip to content

Commit

Permalink
on read, check to make sure we havea user details before accessing it
Browse files Browse the repository at this point in the history
  • Loading branch information
jseriff authored and jseriff-applied committed May 18, 2022
1 parent e213ca0 commit 405d5f1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions mmv1/third_party/terraform/resources/resource_sql_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,13 @@ func resourceSqlUserRead(d *schema.ResourceData, meta interface{}) error {
if err := d.Set("project", project); err != nil {
return fmt.Errorf("Error setting project: %s", err)
}
if err := d.Set("disabled", user.SqlserverUserDetails.Disabled); err != nil {
return fmt.Errorf("Error setting disabled: %s", err)
}
if err := d.Set("server_roles", user.SqlserverUserDetails.ServerRoles); err != nil {
return fmt.Errorf("Error setting server_roles: %s", err)
if user.SqlserverUserDetails != nil {
if err := d.Set("disabled", user.SqlserverUserDetails.Disabled); err != nil {
return fmt.Errorf("Error setting disabled: %s", err)
}
if err := d.Set("server_roles", user.SqlserverUserDetails.ServerRoles); err != nil {
return fmt.Errorf("Error setting server_roles: %s", err)
}
}
d.SetId(fmt.Sprintf("%s/%s/%s", user.Name, user.Host, user.Instance))
return nil
Expand Down

0 comments on commit 405d5f1

Please sign in to comment.