diff --git a/docs/providers/aws/cli-reference/config-credentials.md b/docs/providers/aws/cli-reference/config-credentials.md index e43f2a498..c8586988f 100644 --- a/docs/providers/aws/cli-reference/config-credentials.md +++ b/docs/providers/aws/cli-reference/config-credentials.md @@ -53,4 +53,5 @@ serverless config credentials --provider aws --key 1234 --secret 5678 --profile ``` This example overwrite `custom-profile` profile with the `aws_access_key_id` of `1234` and the `aws_secret_access_key` of `5678`. + If the profile do not exist, it will be added anyway. diff --git a/lib/plugins/aws/configCredentials/awsConfigCredentials.js b/lib/plugins/aws/configCredentials/awsConfigCredentials.js index ea53216e8..4e5906bae 100644 --- a/lib/plugins/aws/configCredentials/awsConfigCredentials.js +++ b/lib/plugins/aws/configCredentials/awsConfigCredentials.js @@ -92,9 +92,11 @@ class AwsConfigCredentials { } else { // Only update the profile if the overwrite flag was set if (!this.options.overwrite) { - this.serverless.cli.log( - `Failed! ~/.aws/credentials already has a "${this.options.profile}" profile. - Use the overwrite flag ("-o" or "--overwrite") to force the update`); + const message = [ + `Failed! ~/.aws/credentials already has a "${this.options.profile}" profile.`, + ' Use the overwrite flag ("-o" or "--overwrite") to force the update', + ].join(''); + this.serverless.cli.log(message); return BbPromise.resolve(); } @@ -151,7 +153,7 @@ class AwsConfigCredentials { return this.serverless.utils.writeFile(this.credentialsFilePath, updatedCredsFileContent) .then(() => { // set file permissions to only readable/writable by owner (equivalent to 'chmod 600') - // Note: `chmod` doesn't behave as intended on Windows, so skip if we're on Windows. + // NOTE: `chmod` doesn't behave as intended on Windows, so skip if we're on Windows. if (os.platform() !== 'win32') { fs.chmodSync( this.credentialsFilePath, diff --git a/lib/plugins/aws/configCredentials/awsConfigCredentials.test.js b/lib/plugins/aws/configCredentials/awsConfigCredentials.test.js index 8a9561158..05e9a6f2b 100644 --- a/lib/plugins/aws/configCredentials/awsConfigCredentials.test.js +++ b/lib/plugins/aws/configCredentials/awsConfigCredentials.test.js @@ -275,7 +275,7 @@ describe('AwsConfigCredentials', () => { expect(profileBoundaries.start).to.equal(-1); }); - it('should set the end to the credentials lentgh if no other profile was found', () => { + it('should set the end to the credentials length if no other profile was found', () => { awsConfigCredentials.options.profile = 'my-profile'; awsConfigCredentials.credentials = [ '[my-profile]',