-
Notifications
You must be signed in to change notification settings - Fork 235
Improvements to the SAR app template #343
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
sbkok
left a comment
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.
Thanks for cleaning up the template!
I've added a few comments that I think should be improved before we can merge this one.
src/template.yml
Outdated
| - !Sub "arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:parameter/deployment_account_region" | ||
| Roles: | ||
| # Created by the Serverless Transform of CrossRegionBucketHandler | ||
| - !GetAtt CrossRegionBucketHandlerRole |
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.
Personally I don't like relying on a to-be-generated transform resource.
This makes reviewing the code very hard to follow.
If this is the only way to break-out of the circular reference, I would rather move the other policies away from the lambda function into a separate role definition as well.
Plus I think this would need to be a !Ref instead of a !GetAtt.
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'll keep the hardcoded name for now, making it a dependency can be done in a different PR
|
Thanks for the review! I'm not sure how I made those mistakes with !Ref and !GetAtt, I had the docs open to check the return values, but apparently still mistyped some things. I'll clean these up, and will have another think about the transformed resource / move that one to a different PR where we can look at defining the Lambda Role in the template instead of relying on the transform. |
|
@sbkok I think I fixed everything, I also made a quick overview of the changes that actually reduce permissions:
Edit: I have to double-check why I did something different for L443 and L833 |
sbkok
left a comment
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 have updated this PR to reflect the latest changes from our main branch + updated some of the issues that were flagged before but not resolved yet.
It looks good to me to merge. Thanks for contributing.
StewartW
left a comment
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.
Looks great. Really tidies up the template 👍
This improves the SAR Application template, I used three commits to make review easier and allow cherry-picking if that would be preferred:
Improve SAR Application template (These are things I discovered by running
cfn-lint -e -cI):arn:aws:witharn:${AWS::Partition}(should help with Basic GovCloud Support #332 )!Join ['', ...]with!SubUpdateReplacePolicyif there was aDeletionPolicy!SubRemove invalid permissions:
s3:Get(without a wildcard) doesn't give any permissionsUse references where possible:
There were still some hardcoded values in the template. I removed those where it was a relatively small change. This should make #342 possible, and make it safer to change names of resources the future.
There are some hardcoded values I didn't change:
project/aws-deployment-framework-base-templates, because removing that circle would require converting a managed policy to an inline policy, which is a bigger changeBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.