Build a graph of resources. Use it to detect circular dependencies#1391
Build a graph of resources. Use it to detect circular dependencies#1391kddejong merged 10 commits intoaws-cloudformation:masterfrom
Conversation
Agreed, I think just documenting how to do that here is a nice compromise:
|
| 'networkx~=2.4;python_version>="3.5"', | ||
| 'networkx~=2.1;python_version<"3.5"' |
There was a problem hiding this comment.
Will need to vet new dependencies
There was a problem hiding this comment.
In terms of license we should be ok: https://tldrlegal.com/license/bsd-3-clause-license-(revised)
|
Nice! From testing, Resource5:
Type: AWS::SNS::Topic
Properties:
DisplayName:
Fn::GetAtt: Resource6.TopicName # dependency only caught in !GetAtt form
# !GetAtt Resource6.TopicName
Resource6:
Type: AWS::SNS::Topic
Properties:
DisplayName:
Ref: Resource5Pushed to your branch if you want to use for testing |
Another option is to put it behind a command or option and test for the existence of pydot if that's used. try:
import pydot
except ImportError:
# give some feedback here |
The new python-networkx dependency is from [1] [1] aws-cloudformation/cfn-lint#1391 git-svn-id: file:///srv/repos/svn-community/svn@602273 9fca08f4-af9d-4005-b8df-a31f2cc04f65

Changes:
networkxto model the template as a graph of resourcesDependsOnedges to the graphWhile debugging I found it very useful to use
networkx.drawing.nx_pydot.write_dot(self.graph, path)which creates a visual representation of the graph. I think it would be useful for customers as well. But I wasn't sure whether to include it in this PR because it needs another dependency,pydotand it would need some work to make it a fancy graph.