(ec2-alpha): Expose `VpcPeeringRole` role name
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Describe the feature
`createAcceptorVpcRole` is a method that creates the role, but then the requester needs the same role to be specified via `peerRoleArn`.
This then introduces a "magic string" anti-pattern.
### Use Case
To avoid magic strings.
### Proposed Solution
Would be great to either have the role name available via some const, or even better have another method:
```
createRequestorPeerRole: IRole
```
And then `createPeeringConnection` would accept `peerRole`, instead of `peerRoleArn`.
Example:
```TypeScript
requestorVpc.createPeeringConnection("Peering", {
acceptorVpc,
peerRole: requestorVpc.createRequestorPeerRole(awsAccount: string)
});
```
### Other Information
https://github.com/aws/aws-cdk/blob/31bf1bfb70adba820281407c11400ed6f744dead/packages/%40aws-cdk/aws-ec2-alpha/lib/vpc-v2-base.ts#L624-L628
### Acknowledgements
- [ ] I may be able to implement this feature request
- [x] This feature might incur a breaking change
### AWS CDK Library version (aws-cdk-lib)
N/A
### AWS CDK CLI version
N/A
### Environment details (OS name and version, etc.)
N/A
Contributor guide
Research direction
Start in packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2-base.ts at the referenced lines, then trace createAcceptorVpcRole and createPeeringConnection. Compare the proposed role-name constant and peer-role API options, and define completion as allowing the requester to reuse the created role without a magic string while accounting for the possible breaking change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure, networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100