pub fn dependency_order(
template_body: &str,
parameters: &BTreeMap<String, String>,
resource_defs: &[ResourceDefinition],
) -> Vec<usize>Expand description
Compute a provisioning order for resource_defs such that every resource is
provisioned after the resources it references — via an explicit
DependsOn or an implicit Ref / Fn::GetAtt / Fn::Sub to another
resource’s logical id.
Returns a permutation of indices into resource_defs. CloudFormation
provisions in dependency order; FakeCloud previously provisioned in template
order, so a Ref to a not-yet-created resource resolved to the bare logical
id (the “not yet provisioned” fallback in resolve_refs_full) and got baked
into derived state — e.g. a Step Functions ASL whose DefinitionSubstitutions
reference a Lambda declared later in the template, leaving the logical id in
the definition and failing every invoke with Lambda.ResourceNotFoundException.
The graph is built from the post-ForEach/post-SAM template so the logical
ids and reference shapes match what provisioning actually sees. Falls back to
the original order on a parse failure or a dependency cycle (which real CFN
rejects outright), and breaks ties by original index so the order is
deterministic.