Repository navigation
feat(aws): accept role name and resolve account ID at deploy time - #959
Conversation
| process.env.CUSTOM_ENV_VAR = 'helix-generic-role'; | ||
| const builder = await new CLI() | ||
| // eslint-disable-next-line no-template-curly-in-string | ||
| .prepare(['--test!important', '${env.CUSTOM_ENV_VAR}']); |
There was a problem hiding this comment.
I thought that we want to support
"aws-role!important": "$HLX_MY_ROLE" ??
There was a problem hiding this comment.
I went with ${env.VARIABLE} because helix-deploy already supports it, so it was the smallest change, but I can add $VARIABLE support if that format is preferred.
There was a problem hiding this comment.
Added the logic for "aws-role!important": "$HLX_MY_ROLE", please take a look when you have time @tripodsan @dominique-pfister
|
This PR will trigger a minor release when merged. |
| const substitute = (value) => { | ||
| if (typeof value !== 'string') { | ||
| return value; | ||
| } | ||
| const match = value.match(/^\$([A-Za-z_][A-Za-z0-9_]*)$/); | ||
| if (match && match[1] in process.env) { | ||
| return process.env[match[1]]; | ||
| } | ||
| return ActionBuilder.substitute(value, envVars); | ||
| }; |
There was a problem hiding this comment.
ah, sorry, I didn't remember that we already had this built in... so I guess the ${var} is not needed....
There was a problem hiding this comment.
let's just keep the existing. sorry again for the extra work
There was a problem hiding this comment.
I reverted the commit, now it should be ready to merge
This reverts commit a8c5e61.
|
🎉 This PR is included in version 14.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
--aws-role(awsRole) now accepts a plain IAM role name in addition to a full ARN. If the value does not start witharn:, it is expanded at deploy time toarn:aws:iam::<accountId>:role/<name>, using the account ID already resolved via STSGetCallerIdentity(initAccountId()).src/deploy/AWSDeployer.js: newroleArngetter, used for the LambdaRoleand the "using lambda role" log line.src/deploy/AWSConfig.js: updated the--aws-rolehelp text.How Has This Been Tested?
test/aws.deployer.test.js:arn:aws:iam::<accountId>:role/<name>(STS mocked via nock)test/cli.test.js:!importantvalue containing${env.X}is substituted and wins over a competingHLX_*env varTypes of changes