Issue
I'm using CfnOutout in my TypeScript CDK code and would like to output secret values, but at the same time hide them from the console log. This is how I use them:
const accessKey = new CfnAccessKey(this, 'testUserKey', {
userName: testUser.userName,
});
const accessKeyId = new CfnOutput(this, 'accessKey', { value: accessKey.ref });
const attrSecretAccessKey = new CfnOutput(this, 'secretAccessKey', { value: accessKey.attrSecretAccessKey });
Is there a way to stop CDK from showing them in the console logs? Currently CDK shows them in the log as below:
Outputs:
stagingConsulComponents.accessKey = ADGHHBAS26TGDRGV
stagingConsulComponents.secretAccessKey = JKGHDJhdskjhfzhfsdjdafhJHJdd
Solution
It doesn't appear there is any way to suppress the output of those values. However, a little sed
work could get you there:
$ cdk deploy ... | sed -E "s/(accessKey) = (.*)$/\1 = masked/" | sed -E "s/(secretAccessKey) = (.*)$/\1 = masked/"
Answered By - Matthew Bonig
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.