aws / aws/aws-cdk

(ec2-alpha): VPCPeeringConnection class needs fromAttributes static method

Open
#35,602 1 comment 0 reactions 0 assignees View on GitHub
aws-cdk-lib effort/medium feature-request p2
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.