Skip to content

Commit

Permalink
Merge pull request #1406 from RoadieHQ/sts-region
Browse files Browse the repository at this point in the history
add region to sts client config
  • Loading branch information
punkle authored May 30, 2024
2 parents 47dfad2 + d52a384 commit 1f54933
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-starfishes-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@roadiehq/catalog-backend-module-aws': patch
---

Use role region for sts client.
1 change: 1 addition & 0 deletions plugins/backend/catalog-backend-module-aws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@backstage/plugin-catalog-backend": "^1.21.1",
"@backstage/plugin-catalog-node": "^1.11.1",
"@backstage/types": "^1.1.1",
"@aws-sdk/util-arn-parser": "^3.76.0",
"link2aws": "^1.0.18",
"lodash": "^4.17.21",
"p-limit": "^3.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
} from '@backstage/catalog-model';
import { ANNOTATION_ACCOUNT_ID } from '../annotations';
import { CatalogApi } from '@backstage/catalog-client';
import { parse as parseArn } from '@aws-sdk/util-arn-parser';

export abstract class AWSEntityProvider implements EntityProvider {
protected readonly accountId: string;
Expand Down Expand Up @@ -66,8 +67,10 @@ export abstract class AWSEntityProvider implements EntityProvider {
}

protected getCredentials() {
const region = parseArn(this.roleArn).region;
return fromTemporaryCredentials({
params: { RoleArn: this.roleArn, ExternalId: this.externalId },
clientConfig: { region: region },
});
}

Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2409,6 +2409,13 @@
dependencies:
tslib "^2.5.0"

"@aws-sdk/util-arn-parser@^3.76.0":
version "3.568.0"
resolved "https://registry.yarnpkg.com/@aws-sdk/util-arn-parser/-/util-arn-parser-3.568.0.tgz#6a19a8c6bbaa520b6be1c278b2b8c17875b91527"
integrity sha512-XUKJWWo+KOB7fbnPP0+g/o5Ulku/X53t7i/h+sPHr5xxYTJJ9CYnbToo95mzxe7xWvkLrsNtJ8L+MnNn9INs2w==
dependencies:
tslib "^2.6.2"

"@aws-sdk/[email protected]":
version "3.521.0"
resolved "https://registry.yarnpkg.com/@aws-sdk/util-dynamodb/-/util-dynamodb-3.521.0.tgz#31d45c950d521550db3b9a65c8dd0c469a1b1698"
Expand Down

0 comments on commit 1f54933

Please sign in to comment.