Skip to content

Commit

Permalink
Merge pull request petoju#51 from petoju/feature/support-changing-pas…
Browse files Browse the repository at this point in the history
…swords

Fix applying changes of passwords
  • Loading branch information
petoju authored Dec 17, 2022
2 parents 212cfb2 + aeb061f commit 4164e7a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions mysql/resource_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ func UpdateUser(ctx context.Context, d *schema.ResourceData, meta interface{}) d
return diag.Errorf("failed running query: %v", err)
}
}

// nothing to change, return
return nil
}

var newpw interface{}
Expand Down Expand Up @@ -217,10 +214,10 @@ func UpdateUser(ctx context.Context, d *schema.ResourceData, meta interface{}) d
if d.HasChange("tls_option") && getVersionFromMeta(ctx, meta).GreaterThan(requiredVersion) {
var stmtSQL string

stmtSQL = fmt.Sprintf("ALTER USER '%s'@'%s' REQUIRE %s",
stmtSQL = fmt.Sprintf("ALTER USER '%s'@'%s' REQUIRE %s",
d.Get("user").(string),
d.Get("host").(string),
fmt.Sprintf(" REQUIRE %s", d.Get("tls_option").(string)))
d.Get("tls_option").(string))

log.Println("Executing query:", stmtSQL)
_, err := db.ExecContext(ctx, stmtSQL)
Expand Down

0 comments on commit 4164e7a

Please sign in to comment.