[Feature] Adding support for passing local paths to nested CloudFormation stacks#2344
[Feature] Adding support for passing local paths to nested CloudFormation stacks#2344dtimberlake wants to merge 2 commits intoaws:developfrom dtimberlake:feature/cf_package_pass_stack_params
Conversation
…tion Stacks before packaging
|
Thanks for the pr! I'll have a look. Looping in the service team: |
JordonPhillips
left a comment
There was a problem hiding this comment.
The implementation mostly seems good, though I think a service team member needs to look at this sort of change.
| PROPERTY_NAME = None | ||
|
|
||
| def __init__(self, uploader): | ||
| def __init__(self, uploader, template_params={}): |
There was a problem hiding this comment.
Mutable objects should not be used for default values.
|
|
||
| def __init__(self, template_path, parent_dir, uploader, | ||
| resources_to_export=EXPORT_DICT): | ||
| resources_to_export=EXPORT_DICT, template_params={}): |
| test_template_params = { | ||
| "Parameter1": "./relative/filepath.txt" | ||
| } | ||
| stack_resource = CloudFormationStackResource(self.s3_uploader_mock, template_params=test_template_params) |
There was a problem hiding this comment.
I know we've already got lots of code in here that breaks this rule, but please stick to < 80 characters per line.
|
@JordonPhillips Changes mentioned have been made |
|
@JordonPhillips Any update? |
|
Hi @dtimberlake, Our team just put out a recent proposal in #6828 detailing improvements to the contribution process. We are working through open PRs and are trying to determine where this issue falls. For feature requests, to invest the time in reviewing it, we would like to make sure the feature has wider community interest and are looking for 10 👍 votes on the issue that I've created for this open PR. For the currently open PR, we are going to set it as a draft. Once the 👍 threshold is met, we will move the issue to the “Implementation” state and re-review the implementation plan in this PR. |
|
With the recent change on cfn-lint v0.66.0 (aws-cloudformation/cfn-lint#2382) relative path Urls like the one above (when using package command) are now returning warnings that cause Git Action failures. If this could be added to the CLI as well that'd be great to make it a non warning. |
|
HI @dtimberlake thanks for creating this PR and for your patience. Could you please rebase this PR against the latest branch for the team’s further consideration going forward? |
|
Checking in again - I'm going to close this PR for now as we have not heard back regarding the request to rebase. But we are continuing to track the feature request in #6961. |
This is a feature I've been using with
aws cloudformation packagefor my own work and thought I'd rework the code and add tests for your consideration for a merge.The idea is to map references in nested stacks to parameters passed in from it's parent stack. The reference is parsed and replaced with the parameter's value (if the value is not dependent on a deploy time parameter) before the
packagecommand exports the resource's artifact to S3.Example:
The command maps the parameter
SwaggerDocinapi-template.yamlto the parameter value passed in frompackage.yaml(/path/to/swagger.yaml) before iterating over the resources. When it comes to theBodyS3Locationproperty ofMyFunctionit will replace the!Ref SwaggerDocwith the value/path/to/swagger.yaml, then export that file to S3.This feature also converts any relative paths to absolute paths by merging with the calling template's parent directory's path.
Example:
./swagger.yamlwould become/absolute/path/to/swagger.yamlThis only affects the the specific properties of resources specified here. Any properties not specified in the previous link are not affected.
I find this really helps keep things DRY when composing multiple connected local templates.
I'd love y'all's feedback.