Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -597,26 +597,29 @@ def _resolve_attribute(self, arguments: str | list[str], select_before: bool) ->
f"Template format error: Unresolved resource dependencies [{logical_name_of_resource}] in the Resources block of the template"
)

# Custom Resources can mutate their definition
# So the preproc should search first in the resource values and then check the template
if select_before:
value = self._before_deployed_property_value_of(
resource_logical_id=logical_name_of_resource,
property_name=attribute_name,
)
else:
value = self._after_deployed_property_value_of(
resource_logical_id=logical_name_of_resource,
property_name=attribute_name,
)
if value is not None:
return value

Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: perhaps consider an early return here - I think it is clearer to return the value found and not continue with the rest of the function implementation.

node_property: NodeProperty | None = self._get_node_property_for(
property_name=attribute_name, node_resource=node_resource
)
if node_property is not None:
# The property is statically defined in the template and its value can be computed.
property_delta = self.visit(node_property)
value = property_delta.before if select_before else property_delta.after
else:
# The property is not statically defined and must therefore be available in
# the properties deployed set.
if select_before:
value = self._before_deployed_property_value_of(
resource_logical_id=logical_name_of_resource,
property_name=attribute_name,
)
else:
value = self._after_deployed_property_value_of(
resource_logical_id=logical_name_of_resource,
property_name=attribute_name,
)

return value

def visit_node_intrinsic_function_fn_get_att(
Expand Down
Loading