pistazie / cdk-dia

Automated diagrams of CDK provisioned infrastructure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Relationships between stacks

eikeon opened this issue · comments

Love the tool so far.

One thing I noticed, is for my case, I'm not seeing any relationships between stacks. Looking at my cdk.out/tree.json many of them show up in the environment variables section of a lambda where the value is a Fn::ImportValue to another stack.

Assuming these are relationships the tool could chase down and draw?

Thank you for the tool!

Tnx @eikeon, interesting feature

Been playing around with this but don't yet have a working solution.

There are a few options for implementation. one could diagram exports, their edge to the resources they export, and their usage as imports. I prefer skipping that and diagraming a direct edge between the originally exported resource and the resource using it in the other stack.

I will try and see how it works out soon.

@pistazie, sounds great, in my use case I think the direct edge approach would work out well. Let me know if you want me to try out a branch or otherwise try and help

Edge resolution between stacks (by Fn::Import and Exports) should now be in place.
upgrade to 0.6.0

Awesome; trying it out now

For the few stacks I've tried so far am running into:

Failed to generate diagram - TypeError: Cannot read property 'stackExportsContainer' of undefined (node:29051) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'stackExportsContainer' of undefined at AwsEdgeResolver.findTargetComponent (/usr/local/lib/node_modules/cdk-dia/dist/src/diagram/aws/aws-edge-resolver.js:70:67)

I published 0.6.1 to fix the above error. while I hope a diagram will now be created for your stacks I'm rather unsure there will be edges between the stacks.

If it doesn't work as expected could you please post the tree.json (found in the cdk.out folder) of one of the stacks? additionally the aws-cdk version could be helpful.

@eikeon did you get a chance to try it out? another use asked about this feature at #19

@pistazie I got a chance to upgrade to 0.6.1 and it's now generating a diagram again. I think it's now showing a few more of the relationships between stacks but not all. I'll send along a tree.json

Hey,

Would you expect that an S3 bucket that has a grantWrite to a lambda in a different stack should show the dependency? I've got that and it doesn't seem to show it. I'm in 0.6.1

@robdmoore I am able to reproduce that. will check why the edge isn't generated.

@robdmoore @eikeon - should now work in 0.7.0.

seems to work for a grantWrite() scenario as seen in pistazie/cdk-dia-test-fixture-apps@85462d8