(CodeCommit): a feature to create approval rule templates
See original GitHub issueDescription
With current CDK, it is hard to create approval rule templates for CodeCommit repositories and engineers need to use 3rd-party NPM package to simplify it such as CloudComponents. Although CloudComponents package has cool features that make it simple, I believe CDK can provide same feature with more intuitive interfaces.
Use Case
Currently I am working on infra stuff with CDK to create CodeCommit repository and related roles and rules. After creating a repository, I tried to create a approval rule template but I couldn’t find the feature with CDK.
In order to find the solution, I searched and found NPM package which is CloudComponents(https://github.com/cloudcomponents/cdk-constructs) and I felt that it seemed kind of tricky to create an approval rule template using current CDK. Too many steps which are not intuitive and somehow creating lambda functions for approval rule templates seems like being used only once for creating the template.
Proposed Solution
// Create a new template
const myTemplate = new codecommit.ApprovalRuleTemplate(scope, 'MyApprovalRuleTemplate' {
approvalRuleTemplateName: 'template name',
description: 'description text',
numberOfApprovalsNeeded: 2,
approverType: {
type: 'IAM user name or assumed role',
value: 'gitUserRole'
},
branches: ["main", "release"]
});
// Associate the template to a repository
myTemplate.associateRepository(repo);
Other information
No response
Acknowledge
- I may be able to implement this feature request
- This feature might incur a breaking change
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:6 (4 by maintainers)
Can I recommend writing a resource provider instead of a custom resource? This way other users of CloudFormation would also benefit and the code would have a managed release cycle instead of being buried inside the CDK source code.
Looking into current possibility, I recommend implementing this feature using Custom Resource Provider . It supports only NODEJS runtime handler.
You can use codecommit SDK. Now use this provider service token in Custom Resource. Properties(Properties to pass to the Lambda) are really helpful, to have all customisation in Lambda.
Note: You have to deal with cfn response, otherwise Custom Resource will be in “Creating” phase and cloudformation gets timeout afterwards. Refer cfn-response module.