-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CfnTransitGatewayRouteTable: not returning the default routing table to add additional routes #24473
Comments
Thank you for your feedback. As TransitGateway is currently L1 construct, it's pretty much cloudformation resources mapping at this moment. But I will try reproduce this in my environment and see what I can do with that. Meanwhile, any community feedbacks are welcome and highly appreciated here. |
Hi I got your point here. This causes circular dependency and it seems not possible to deploy with native cloudformation resources like that. I'll try reproduce it in my account. |
Hi, From my test with cdk new ec2.CfnTransitGateway(this, 'TGW', {
autoAcceptSharedAttachments: 'enable',
defaultRouteTableAssociation: 'enable',
vpnEcmpSupport: 'enable',
defaultRouteTablePropagation: 'enable',
}) According to the doc:
Let me know if it works with you. |
Thank you for the update, we need to create a custom table due to some other requirements. Ended up creating a custom resource to update those values using SDK. |
@edwinperez Yeah I also noticed some limitation. The TransitGateway CFN resource will not return its default routing table ID(see return values) so it would be difficult to add additional route into the generated default routing table. To fill such gap, custom resource would be required at this moment. I will keep this issue open until we fill the gap from CFN. |
I have reported this to the CFN coverage map |
Here's the code of a custom resource to get the default route table ID: const getDefaultRouteTableId = new cr.AwsCustomResource(this, 'GetDefaultRouteTableId', {
onUpdate: {
service: 'EC2',
action: 'describeTransitGateways',
parameters: {
TransitGatewayIds: [this.tgw.ref],
},
physicalResourceId: cr.PhysicalResourceId.of('GetDefaultRouteTableId'),
},
policy: cr.AwsCustomResourcePolicy.fromSdkCalls({
resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE,
}),
});
const routeTableId = getDefaultRouteTableId.getResponseField(
'TransitGateways.0.Options.AssociationDefaultRouteTableId',
);
peerCidrs.forEach((cidr, i) => {
new ec2.CfnTransitGatewayRoute(this, `TgwRoute${i}`, {
destinationCidrBlock: cidr,
transitGatewayRouteTableId: routeTableId,
transitGatewayAttachmentId: peeringAttachmentId,
});
}); |
It feels really broken to have the Transit Gateway L1 automatically create a default route table, and then have no way to access it? A custom resource is definitely not ideal. |
Describe the bug
In:
"aws-cdk": "2.46.0"
When creating TransitGateway:
you get the following error:
failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "enable DefaultRouteTableAssociation conflicts with AssociationDefaultRouteTableId null
Essentially the AssociationDefaultRouteTableId and PropagationDefaultRouteTableId are required. However in order to create a routing table you must have the transitGatewayID: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.CfnTransitGatewayRouteTable.html
If you try to overwrite TransitGateway properties after you initialize a routing table you get a circular dependency error.
Expected Behavior
You must be able to create a routing table and overwrite the TransitGateway params to enable default association and propagation.
Current Behavior
It is impossible to configure default propagation and association routing table.
Reproduction Steps
This will give you the error:
failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "enable DefaultRouteTableAssociation conflicts with AssociationDefaultRouteTableId null
Get the error:
[[securityCenterDefaultTgwRouteTable](failed: Error [ValidationError]: Circular dependency between resources: [securityCenterDefaultTgwRouteTable, ....)
Possible Solution
Remove circular dependency or create a custom resource to update once created.
Additional Information/Context
No response
CDK CLI Version
2.46.0
Framework Version
No response
Node.js Version
v16.15.0
OS
13.1 (22C65)
Language
Typescript
Language Version
4.6.3
Other information
No response
The text was updated successfully, but these errors were encountered: