aws / aws/aws-cdk

(ec2): default vpn amazon side asn equals default customer side asn

Open
#22,848 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-ec2 bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

When deploying a VPN Connection you can supply the ASN of the Customer Gateway. Due to a bug in CDK, the same ASN is used for the AmazonSideAsn parameter on the VPN Gateway it creates.

### Expected Behavior

The VPN Connection should create a VPN Gateway resource with a non-specified AmazonSideAsn parameter and have CloudFormation handle the creation of the resource.

### Current Behavior

Stack creation/update fails with the following message:
```
Resource handler returned message: "The ASN of the specified customer gateway and virtual private gateway are the same.
```

### Reproduction Steps

```python
app = cdk.App()
stack = cdk.Stack(app, 'stack')
vpc = ec2.Vpc(
stack, 'vpc',
)
ec2.VpnConnection(
stack, 'vpn',
vpc=vpc,
ip='1.1.1.1',
asn=65001
)
app.synth()
```

### Possible Solution

Delete this line: https://github.com/aws/aws-cdk/blob/4bdb18e6a43c41ad403c16ab836fe7b991f9531c/packages/%40aws-cdk/aws-ec2/lib/vpn.ts#L295

### Additional Information/Context

Not supplying the customer gateway ASN results in something entirely different from 65000, so I think this number is generated upon resource creation.

### CDK CLI Version

2.50.0

### Framework Version

_No response_

### Node.js Version

v14.17.6

### OS

MacOS Ventura

### Language

Python

### Language Version

3.9.13

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at packages/@aws-cdk/aws-ec2/lib/vpn.ts around line 295, referenced by the issue, and compare the synthesized VPN Gateway configuration with the Python reproduction. Confirm that AmazonSideAsn is omitted when only the customer gateway ASN is supplied, then verify the synthesized output and the reported deployment failure no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, networking
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.