@@ -163,21 +163,16 @@ func resolveCredentials(d *schema.ResourceData) (string, string, error) {
163163 if (! ok ) || username == nil {
164164 return "" , "" , fmt .Errorf ("Username is required" )
165165 }
166- password , passwordIsSet := d .GetOk ("password" )
167- _ , clusterIdentifierIsSet := d .GetOk ("temporary_credentials.0.cluster_identifier" )
168- if ! passwordIsSet && ! clusterIdentifierIsSet {
169- return "" , "" , fmt .Errorf ("password or temporary_credentials must be configured" )
166+ if _ , useTemporaryCredentials := d .GetOk ("temporary_credentials.0" ); useTemporaryCredentials {
167+ log .Println ("[DEBUG] using temporary credentials authentication" )
168+ dbUser , dbPassword , err := temporaryCredentials (username .(string ), d )
169+ log .Printf ("[DEBUG] got temporary credentials with username %s\n " , dbUser )
170+ return dbUser , dbPassword , err
170171 }
171- if passwordIsSet {
172- if password .(string ) != "" {
173- log .Println ("[DEBUG] using password authentication" )
174- return username .(string ), password .(string ), nil
175- }
176- }
177- log .Println ("[DEBUG] using temporary credentials authentication" )
178- dbUser , dbPassword , err := temporaryCredentials (username .(string ), d )
179- log .Printf ("[DEBUG] got temporary credentials with username %s\n " , dbUser )
180- return dbUser , dbPassword , err
172+
173+ password , _ := d .GetOk ("password" )
174+ log .Println ("[DEBUG] using password authentication" )
175+ return username .(string ), password .(string ), nil
181176}
182177
183178// temporaryCredentials gets temporary credentials using GetClusterCredentials
0 commit comments