Skip to content

Conversation

@to-mc
Copy link
Contributor

@to-mc to-mc commented Oct 11, 2019

Issue #, if available: #1160

Description of changes: Enable propagation of tags from Serverless::Function resources to the IAM Roles generated. This includes the default tag (lambda:createdBy: SAM). Updated the expected output json files so the unit tests pass with tags now being automatically added to iam roles.

Description of how you validated changes: Followed "verifying transforms" guidance in the development guide with some basic templates. Ran unit tests with updated expected output json files.

Checklist:

  • Write/update tests
  • make pr passes
  • Update documentation
  • Verify transformed template deploys and application functions as expected
  • Add/update example to examples/2016-10-31

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Tom McCarthy added 3 commits October 11, 2019 23:50
Update IAMRole resource to accept tags property
Update _construct_role method on SamFunction resource to pass tags to IAMRole
Update translator tests outputs to expect "tags" on generated iam roles
@codecov-io
Copy link

Codecov Report

Merging #1194 into develop will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1194      +/-   ##
===========================================
+ Coverage    94.33%   94.33%   +<.01%     
===========================================
  Files           72       72              
  Lines         3725     3726       +1     
  Branches       733      733              
===========================================
+ Hits          3514     3515       +1     
  Misses         107      107              
  Partials       104      104
Impacted Files Coverage Δ
samtranslator/model/iam.py 81.25% <100%> (ø) ⬆️
samtranslator/model/sam_resources.py 95.61% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1f2a34...f4d6a34. Read the comment docs.

Copy link

@ShreyaGangishetty ShreyaGangishetty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cakepietoast thanks for contributing this feature!
Could you please add a unit test case by adding some tags on the AWS::Serverless::Function resource?
Otherwise this PR looks good to me

@to-mc
Copy link
Contributor Author

to-mc commented Oct 25, 2019

@cakepietoast thanks for contributing this feature!
Could you please add a unit test case by adding some tags on the AWS::Serverless::Function resource?
Otherwise this PR looks good to me

There's already a test case in TestTranslatorEndToEnd basic_functions_with_tags that tests this functionality. Is there something more specific you'd like me to add?

@ShreyaGangishetty
Copy link

@cakepietoast That should be enough. I was looking for a SAM transform template output where user-defined tags get added to AWS::Iam::Role along with tags generated by SAM. Found it here.
Approving the changes. This looks good to me.

Copy link
Contributor

@keetonian keetonian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thank you for making this change!

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

Successfully merging this pull request may close these issues.

5 participants