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

feat: adding support for SSM Parameters (string) as Type #2469

Conversation

LautaroJayat
Copy link
Contributor

@LautaroJayat LautaroJayat commented Aug 10, 2022

Issue #, if available:
#2301

Description of changes:

  • added new entry on parameters.json > Types > enum
  • added one input to test all correct types pass
  • added one input and output to test that it will fail if a Parameter is not included in the enum from parameters.json
  • updated test_validator_root to include these new cases

Description of how you validated changes:

  • Added missing tests to validate Parameter types are included in the parameter types enum.

Checklist:

  • Add/update unit tests using:
  • Add/update integration tests
  • make pr passes
  • Update documentation
  • Verify transformed template deploys and application functions as expected
  • Do these changes include any template validations?
    • Did the newly validated properties support intrinsics prior to adding the validations? (If unsure, please review Intrinsic Functions before proceeding).
      • Does the pull request ensure that intrinsics remain functional with the new validations?

Examples?

Please reach out in the comments, if you want to add an example. Examples will be
added to sam init through https://github.com/awslabs/aws-sam-cli-app-templates/

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

* added new entry on parameters.json > Types > enum
* added one input to test all correct types pass
* added one input and output to test that it will fail if a Parameter is not included in the enum from parameters.json
* updated test_validator_root to include these new cases
@github-actions github-actions bot added pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Aug 10, 2022
@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2022

Codecov Report

Merging #2469 (6e99374) into develop (e7a1496) will increase coverage by 0.89%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop    #2469      +/-   ##
===========================================
+ Coverage    93.58%   94.48%   +0.89%     
===========================================
  Files           90       98       +8     
  Lines         6124     7285    +1161     
  Branches      1260     1517     +257     
===========================================
+ Hits          5731     6883    +1152     
- Misses         183      194      +11     
+ Partials       210      208       -2     
Impacted Files Coverage Δ
samtranslator/region_configuration.py 77.77% <0.00%> (-22.23%) ⬇️
samtranslator/model/codedeploy.py 90.90% <0.00%> (-9.10%) ⬇️
samtranslator/validator/validator.py 91.80% <0.00%> (-3.85%) ⬇️
samtranslator/model/exceptions.py 97.67% <0.00%> (-2.33%) ⬇️
samtranslator/open_api/open_api.py 90.16% <0.00%> (-1.81%) ⬇️
samtranslator/model/s3_utils/uri_parser.py 68.42% <0.00%> (-0.81%) ⬇️
samtranslator/yaml_helper.py 89.47% <0.00%> (-0.53%) ⬇️
samtranslator/translator/logical_id_generator.py 90.62% <0.00%> (-0.29%) ⬇️
samtranslator/model/apigateway.py 96.98% <0.00%> (-0.18%) ⬇️
samtranslator/intrinsics/resource_refs.py 95.83% <0.00%> (-0.17%) ⬇️
... and 44 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@hawflau hawflau left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! LGTM!

@LautaroJayat
Copy link
Contributor Author

If someone could give me some info on what are the actual SSM Parameter Types that SAM support, I would really love to update the PR to include all of them.

@hawflau
Copy link
Contributor

hawflau commented Aug 11, 2022

If someone could give me some info on what are the actual SSM Parameter Types that SAM support, I would really love to update the PR to include all of them.

That's a good question.

In fact, SAM works as a CloudFormation Macro. As the doc suggests, it supplies templateParameterValues to SAM. So I think SAM would just receive whatever value (string or list) the SSM parameter resolves to. Here's the list of supported SSM parameter types in CloudFormation - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#aws-ssm-parameter-types.

Edit: My statement above is probably inaccurate. Let me confirm the behavior and I will update my comment.

@LautaroJayat
Copy link
Contributor Author

@hawflau,
For what I've read in the source, I understand SAM the same way as you are commenting above.
Nonetheless, I would like to only add the parameters that actually will end up working fine after the cloudformation resources are created. That is why I'm trying to find that list, just to let sam validate be consistent with the things that actually work after sam build and sam deploy.

@LautaroJayat LautaroJayat changed the title feat: adding support for SSM Parameters as Type feat: adding support for SSM Parameters (string) as Type Aug 11, 2022
@hawflau
Copy link
Contributor

hawflau commented Aug 11, 2022

@LautaroJayat

Yep, the inaccurate part in my comment was " I think SAM would just receive whatever value (string or list) the SSM parameter resolves to". But that's not the point in this PR. I agree that the parity between sam validate and other commands like sam deploy should be fixed.

Just want to confirm - do other supported SSM Parameter types also work in sam deploy? If so, I think we can include them in this PR.

@LautaroJayat
Copy link
Contributor Author

LautaroJayat commented Aug 12, 2022

@hawflau
I think we could use this list: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#aws-specific-parameter-types-supported
Is the official documentation, I guess it is up to date.
The only thing that makes me go with caution is the fact that the doc is in the context of cloudformation.
But, on the other side, when you click on "Parameters (optional)" when reading about the sections of the SAM Template, you are redirected to the Cloudformation parameters documentation.
If you agree, I will update the PR to include all of them.

@jfuss jfuss removed the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Aug 16, 2022
@mndeveci mndeveci merged commit 74f24fe into aws:develop Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants