Skip to content
Merged
Show file tree
Hide file tree
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 @@ -45,10 +45,14 @@ def _is_first_stage(self, full_path: deque) -> bool | None:
if path[i] == "Fn::If":
i += 2
continue
if path[i] == 0:
return True
elif isinstance(path[i], int):
return False
if isinstance(path[i], int):
# When a stage entry is itself wrapped in an Fn::If it can
# resolve to AWS::NoValue, so the list index no longer reflects
# the realized order of the stages. We can't tell where this
# stage lands, so don't make a first-stage determination.
if i + 1 < len(path) and path[i + 1] == "Fn::If":
return None
return bool(path[i] == 0)
i += 1

return None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,29 @@ def _append_queues(queue1: Iterable, queue2: Iterable) -> deque:
)
],
),
(
# A stage entry that is itself an Fn::If can resolve to
# AWS::NoValue, so the list index no longer reflects the realized
# order. A source stage at any such index must not be flagged.
"Source",
{
"path": _append_queues(
_standard_path,
[1, "Fn::If", 1, "Actions", 0, "ActionTypeId", "Category"],
),
},
[],
),
(
"Source",
{
"path": _append_queues(
_standard_path,
[0, "Fn::If", 1, "Actions", 0, "ActionTypeId", "Category"],
),
},
[],
),
],
indirect=["path"],
)
Expand Down
Loading