Skip to content
This repository was archived by the owner on Jul 26, 2022. It is now read-only.

Commit 117b926

Browse files
authored
fix: use assumeRoleWithWebIdentity when using IRSA (#416)
* add support for assumeRoleWithWebIdentity when used on AWS Fargate IRSA * removed trailing spaces as detected by eslint
1 parent 10e3991 commit 117b926

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

config/aws-config.js

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const clonedeep = require('lodash.clonedeep')
66
const merge = require('lodash.merge')
77

88
const localstack = process.env.LOCALSTACK || 0
9+
const webIdentity = process.env.AWS_WEB_IDENTITY_TOKEN_FILE || 0
910

1011
let secretsManagerConfig = {}
1112
let systemManagerConfig = {}
@@ -44,6 +45,17 @@ module.exports = {
4445
},
4546
assumeRole: (assumeRoleOpts) => {
4647
const sts = new AWS.STS(stsConfig)
48+
if (webIdentity) {
49+
return new Promise((resolve, reject) => {
50+
sts.assumeRoleWithWebIdentity(assumeRoleOpts, (err, res) => {
51+
if (err) {
52+
return reject(err)
53+
}
54+
resolve(res)
55+
})
56+
})
57+
}
58+
4759
return new Promise((resolve, reject) => {
4860
sts.assumeRole(assumeRoleOpts, (err, res) => {
4961
if (err) {

0 commit comments

Comments
 (0)