-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
CFNv2: support dynamic parameter resolution #12797
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
acc5133
to
6574897
Compare
@@ -1040,7 +1045,23 @@ def visit_node_array(self, node_array: NodeArray) -> PreprocEntityDelta: | |||
return PreprocEntityDelta(before=before, after=after) | |||
|
|||
def visit_node_property(self, node_property: NodeProperty) -> PreprocEntityDelta: | |||
return self.visit(node_property.value) | |||
# TODO: is this the right place? |
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.
Are dynamic parameters only resolved at a property level? For example, these are never resolved as input for another intrinsic function?
6c4cd17
to
2ac855d
Compare
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.
LGTM. I like the moving of the resolution of paramters from the executor, to the preproc.
suggestion: Maybe add or modify a test to confirm if the resolved parameters can be used in an intrinsic function.
@@ -394,7 +394,7 @@ def test_create_change_set_missing_stackname(aws_client): | |||
) | |||
|
|||
|
|||
@pytest.mark.skip("CFNV2:Other") | |||
# @pytest.mark.skip("CFNV2:Other") |
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.
Nit: we should delete the comment if it doesn't apply anymore.
parameter_value = value.get("ParameterValue", "") | ||
# V2: we model parameters as classes so try to access the method that returns the resolved value | ||
if resolve := getattr(parameter_value, "resolve", None): | ||
parameter_value = resolve() | ||
formatted_stack_parameters[key] = parameter_value.split(",") |
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.
comment: Thanks for adapting the execute_macro
function but I believe that we should have a new one with proper typing and bindings for the v2 engine. Of course that should be handled in another PR not this one.
if dynamic_ref := extract_dynamic_reference(result): | ||
return perform_dynamic_reference_lookup( | ||
reference=dynamic_ref, | ||
account_id=account_id, | ||
region_name=region_name, | ||
) |
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.
comment: Nice refactoring
Closing in favour of #12965 |
Motivation
The V2 engine does not currently support resolving dynamic parameter values, e.g.
Changes