-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[Feature] Adding support for passing local paths to nested CloudFormation stacks #2344
[Feature] Adding support for passing local paths to nested CloudFormation stacks #2344
Conversation
…tion Stacks before packaging
Thanks for the pr! I'll have a look. Looping in the service team: |
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 implementation mostly seems good, though I think a service team member needs to look at this sort of change.
@@ -206,14 +206,18 @@ class Resource(object): | |||
|
|||
PROPERTY_NAME = None | |||
|
|||
def __init__(self, uploader): | |||
def __init__(self, uploader, template_params={}): |
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.
Mutable objects should not be used for default values.
@@ -364,7 +407,7 @@ class Template(object): | |||
""" | |||
|
|||
def __init__(self, template_path, parent_dir, uploader, | |||
resources_to_export=EXPORT_DICT): | |||
resources_to_export=EXPORT_DICT, template_params={}): |
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.
Mutable default value
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 package
for 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
package
command exports the resource's artifact to S3.Example:
The command maps the parameter
SwaggerDoc
inapi-template.yaml
to the parameter value passed in frompackage.yaml
(/path/to/swagger.yaml
) before iterating over the resources. When it comes to theBodyS3Location
property ofMyFunction
it will replace the!Ref SwaggerDoc
with 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.yaml
would become/absolute/path/to/swagger.yaml
This 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.