Add support for masking the AWS account ID from logs

This commit is contained in:
Clare Liguori
2019-11-01 20:49:03 -07:00
parent 3aa1c0e14d
commit da518c1c8a
3 changed files with 30 additions and 1 deletions
+4
View File
@@ -8,6 +8,7 @@ async function run() {
const secretAccessKey = core.getInput('aws-secret-access-key', { required: true });
const region = core.getInput('aws-region', { required: true });
const sessionToken = core.getInput('aws-session-token', { required: false });
const maskAccountId = core.getInput('mask-aws-account-id', { required: false });
// Configure the AWS CLI and AWS SDKs using environment variables
@@ -35,6 +36,9 @@ async function run() {
const identity = await sts.getCallerIdentity().promise();
const accountId = identity.Account;
core.setOutput('aws-account-id', accountId);
if (!maskAccountId || maskAccountId.toLowerCase() == 'true') {
core.setSecret(accountId);
}
}
catch (error) {
core.setFailed(error.message);