-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix: bug fixes in resource policies #1395
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1395 +/- ##
===========================================
- Coverage 94.44% 94.37% -0.08%
===========================================
Files 78 78
Lines 4557 4584 +27
Branches 911 917 +6
===========================================
+ Hits 4304 4326 +22
Misses 119 119
- Partials 134 139 +5
Continue to review full report at Codecov.
|
samtranslator/swagger/swagger.py
Outdated
if is_intrinsic_if(custom_statements): | ||
if_list = custom_statements.get("Fn::If") | ||
## copy the statement created so far | ||
original = self.resource_policy.copy() | ||
if_true = if_list[1] | ||
if_false = if_list[2] | ||
if not is_intrinsic_no_value(if_list[1]): | ||
self._add_custom_statement(if_list[1]) | ||
if_true = self.resource_policy | ||
self.resource_policy = original | ||
if not is_intrinsic_no_value(if_list[2]): | ||
self._add_custom_statement(if_list[2]) | ||
if_false = self.resource_policy | ||
self.resource_policy = make_conditional(if_list[0], if_true, if_false) | ||
else: | ||
self._add_custom_statement(custom_statements) |
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.
Why do we need to do this? Does it not work to just pass it straight through and let CFN resolve the if statement?
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.
The merge between global custom statements and local with if
won't be handled.
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.
Could you add a test case then that tests this flow? I don't see a test case that has both local and global custom statements.
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.
The core change and tests look good! Fixing the example is the only blocker right now.
Added support for intrinsics Ref for api auth Added support for fn::if in CustomStatements Fixed the policy getting created for vpc whitelist to be 'OR' instead of 'AND'
Added support for intrinsics Ref for api auth
Added support for fn::if in CustomStatements
Fixed the policy getting created for vpc whitelist to be 'OR' instead of 'AND'
Issue #, if available:
#1249 #1372 #1218
Description of changes:
Description of how you validated changes:
Checklist:
make pr
passesexamples/2016-10-31
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.