(ec2-alpha): VPCPeeringConnection class needs fromAttributes static method
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Describe the feature
https://github.com/aws/aws-cdk/blob/2c22a6d5ad47f96ba2e171c39b81c565c5c5a1b4/packages/%40aws-cdk/aws-ec2-alpha/lib/route.ts#L509
### Use Case
Adding a route to the pass gateway requires specifying an `IRouteTarget`.
### Proposed Solution
Add a static method to create an instance from known values.
### Other Information
Current workaround:
```TypeScript
peeringRouteTable.addRoute("x", "10.0.0.0/18", {
gateway: new (class extends Resource implements IRouteTarget {
routerType = RouterType.VPC_PEERING_CONNECTION;
routerTargetId = "pcx-...";
})(this, "PeeringConnection"),
});
```
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] 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 at packages/@aws-cdk/aws-ec2-alpha/lib/route.ts around line 509 and inspect VPCPeeringConnection and IRouteTarget. Add a static fromAttributes entry point that creates an instance from known values so it can be passed as the gateway in peeringRouteTable.addRoute. Confirm the resulting instance supplies the route target information shown in the workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, networking
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100