Add an optional external Id field

Signed-off-by: Iain Billett <iain@roadie.io>
This commit is contained in:
Iain Billett
2022-03-10 14:41:07 +00:00
parent ef09266bc7
commit a8c5f1a08f
3 changed files with 17 additions and 0 deletions
@@ -154,11 +154,15 @@ export class AwsS3UrlReader implements UrlReader {
const roleArn = integration.config.roleArn;
if (roleArn) {
const externalIdParam = integration.config.externalId
? { ExternalId: integration.config.externalId }
: {};
return new aws.ChainableTemporaryCredentials({
masterCredentials: explicitCredentials,
params: {
RoleSessionName: 'backstage-aws-s3-url-reader',
RoleArn: roleArn,
...externalIdParam,
},
});
}
+6
View File
@@ -200,6 +200,12 @@ export interface Config {
* @visibility backend
*/
roleArn?: string;
/**
* External ID to use when assuming role
* @visibility backend
*/
externalId?: string;
}>;
};
}
+7
View File
@@ -59,6 +59,11 @@ export type AwsS3IntegrationConfig = {
* (Optional) ARN of role to be assumed
*/
roleArn?: string;
/**
* (optional) External ID to use when assuming role
*/
externalId?: string;
};
/**
@@ -98,6 +103,7 @@ export function readAwsS3IntegrationConfig(
const accessKeyId = config.getOptionalString('accessKeyId');
const secretAccessKey = config.getOptionalString('secretAccessKey');
const roleArn = config.getOptionalString('roleArn');
const externalId = config.getOptionalString('externalId');
return {
host,
@@ -106,6 +112,7 @@ export function readAwsS3IntegrationConfig(
accessKeyId,
secretAccessKey,
roleArn,
externalId,
};
}