Skip to content
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

EC2 Route error when targeting prefix list ID #2279

Closed
gph2584 opened this issue Jan 16, 2025 · 6 comments
Closed

EC2 Route error when targeting prefix list ID #2279

gph2584 opened this issue Jan 16, 2025 · 6 comments

Comments

@gph2584
Copy link
Contributor

gph2584 commented Jan 16, 2025

Troposphere throws the following error when adding an ec2.Route resource: "[ERROR] Route: one of the following must be specified: DestinationCidrBlock, DestinationIpv6CidrBlock" .
However, cloudformation now supports prefix lists as targets for routes: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html "You must specify either a destination CIDR block or prefix list ID. You must also specify exactly one of the resources as the target"

@markpeek
Copy link
Member

Completely untested but see if this works:

% git diff
diff --git a/troposphere/validators/ec2.py b/troposphere/validators/ec2.py
index 1c9977ec..74a4bdea 100644
--- a/troposphere/validators/ec2.py
+++ b/troposphere/validators/ec2.py
@@ -268,6 +268,7 @@ def validate_route(self):
     cidr_conds = [
         "DestinationCidrBlock",
         "DestinationIpv6CidrBlock",
+        "DestinationPrefixListId",
     ]
     gateway_conds = [
         "CarrierGatewayId",

@gph2584
Copy link
Contributor Author

gph2584 commented Jan 16, 2025

Thanks @markpeek I can confirm this works.

@gph2584
Copy link
Contributor Author

gph2584 commented Jan 16, 2025

It appears I do not have permission to branch and submit a pull request for this.

@markpeek
Copy link
Member

The model is fork/PR for changes. But since I have it in my tree already I'll just commit directly.

@gph2584
Copy link
Contributor Author

gph2584 commented Jan 16, 2025

I figured it out and just opened this: #2280
Thanks!

@markpeek
Copy link
Member

Thank you for the issue and PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants