-
Notifications
You must be signed in to change notification settings - Fork 4.1k
serviceCatalog: Incorrect service in arn generation #20849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @joostvdwsd, thank you for raising this issue. This is certainly a valid bug and I will reproduce it locally and determine the most appropriate next steps. Based on your included possible solution, I suspect that this will be a relatively trivial fix. |
There are two ARN services that are defined in Service Catalog - both servicecatalog and catalog. Why? Who knows. It's documented where each is used in different places: https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsservicecatalog.html#awsservicecatalog-resources-for-iam-policies |
…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*
|
…ws#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 aws#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*
Describe the bug
The generated portfolio arn is using service "servicecatalog". However, arns of service catalog have the service "catalog":
arn:aws:catalog:<>:<>:portfolio/<>
aws-cdk/packages/@aws-cdk/aws-servicecatalog/lib/portfolio.ts
Line 331 in 2f6dd37
Expected Behavior
Use the correct service in the generated arn
Current Behavior
Incorrect generated arn resulting in permission errors i.e. when used in a policy statement
Reproduction Steps
const portfolio = new servicecatalog.Portfolio(this, 'Portfolio', {
displayName: 'My Portfolio',
providerName: 'AWS',
});
console.log(portfolio.portfolioArn)
Possible Solution
aws-cdk/packages/@aws-cdk/aws-servicecatalog/lib/portfolio.ts
Line 331 in 2f6dd37
change into:
cdk.Stack.of(this).formatArn({
service: 'catalog',
resource: 'portfolio',
resourceName: this.portfolioId,
})
Additional Information/Context
No response
CDK CLI Version
latest
Framework Version
No response
Node.js Version
any
OS
any
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: