-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
CFn: better validation of select construct #13136
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
Conversation
1c5fda5 to
81003e6
Compare
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 34m 9s ⏱️ - 1h 21m 36s Results for commit 8546b18. ± Comparison against base commit 515c19b. This pull request removes 4098 and adds 3 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Test Results (amd64) - Integration, Bootstrap 5 files 5 suites 47m 1s ⏱️ Results for commit 8546b18. ♻️ This comment has been updated with latest results. |
Test Results - Alternative Providers563 tests 329 ✅ 24m 16s ⏱️ Results for commit 8546b18. ♻️ This comment has been updated with latest results. |
| "Template error: Fn::Select requires a list argument with two elements: an integer index and a list" | ||
| ) from e | ||
|
|
||
| # defer evaluation if the selection list contains unresolved elements (e.g., unresolved intrinsics) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to reconsider this approach in the future. Either we need a sentinel value to represent in non-computable values or we investigate splitting up the preprocessor but for now this approach works.
Motivation
A user experienced the following issue when deploying their stack:
We already have validation of index, but guess what: it was an off-by-one error!
Note
This was actually during template modelling and was not a result of an error on their part. In the transformer we try to call the preprocessor's method (in case any child intrinsic functions only access parameter values) and ignore any exceptions and continue visiting. However in this case the bad index check was raising an
IndexErrorrather than the specificRuntimeErrorthat we already catch.We should still be more strict in validating the select construct
Changes