Skip to content

Commit f9ca639

Browse files
fix(servicecatalog): incorrect service in portfolio arn generation (#21770)
Portfolio construct code uses the incorrect service name when generating the ARN for the portfolio. The ARN generated uses the service name "servicecatalog" instead of "catalog". CLI documentation confirms ARN should use catalog instead of servicecatalog: https://docs.aws.amazon.com/cli/latest/reference/servicecatalog/create-portfolio.html Added a single unit test to check arn formatting. fixes #20849 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent d30a530 commit f9ca639

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Diff for: packages/@aws-cdk/aws-servicecatalog/lib/portfolio.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ export class Portfolio extends PortfolioBase {
329329
});
330330
this.portfolioId = this.portfolio.ref;
331331
this.portfolioArn = cdk.Stack.of(this).formatArn({
332-
service: 'servicecatalog',
332+
service: 'catalog',
333333
resource: 'portfolio',
334334
resourceName: this.portfolioId,
335335
});

Diff for: packages/@aws-cdk/aws-servicecatalog/test/portfolio.test.ts

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ describe('Portfolio', () => {
6262
}).toThrowError(/Missing required Portfolio ID from Portfolio ARN/);
6363
}),
6464

65+
test('portfolio arn formatting', () => {
66+
const portfolio = new servicecatalog.Portfolio(stack, 'Portfolio', {
67+
displayName: 'MyPortfolio',
68+
providerName: 'testProvider',
69+
});
70+
expect(portfolio.portfolioArn).toEqual(`arn:${stack.partition}:catalog:${stack.region}:${stack.account}:portfolio/${portfolio.portfolioId}`);
71+
}),
72+
6573
test('fails portfolio creation with short name', () => {
6674
expect(() => {
6775
new servicecatalog.Portfolio(stack, 'MyPortfolio', {

0 commit comments

Comments
 (0)