Sceptre / sceptre

Build better AWS infrastructure
https://docs.sceptre-project.org
Other
1.49k stars 313 forks source link

[Resolve #1446] Print edges in cyclical dependency #1447

Closed alex-harvey-z3q closed 9 months ago

alex-harvey-z3q commented 9 months ago

This adds some code to print a clearer error message similar to Terraform's when a cyclical dependency is detected in the graph.

Before this change an error message would look like:

Dependency cycle detected: configmap-lambda eks-securitygroups

After this change it becomes:

Dependency cycle detected: eks-securitygroups -> configmap-lambda, configmap-lambda -> eks-securitygroups

An example of a Terraform error message would be:

Error: Cycle: aws_scheduler_schedule.gh_runners_ubuntu_stop, aws_iam_role.gh_runners_ubuntu_scheduler_role, aws_scheduler_schedule.gh_runners_ubuntu_start

And for comparison see this related section of the source code for Terraform: https://github.com/hashicorp/terraform/blob/268c8e264d22604f2a4ec516ed4df7a5bdef421f/internal/dag/dag.go#L117-L148

PR Checklist

Approver/Reviewer Checklist

Other Information

Guide to writing a good commit