pistazie / cdk-dia

Automated diagrams of CDK provisioned infrastructure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: add granted resources and actions into diagram

dnltsk opened this issue · comments

Awesome tool 💪

Seems that imported resources aren't considered yet when generating the diagram.

For example, the following cdk code

Bucket.fromBucketName(this, 'my-bucket-import', 'my-bucket').grantRead(instance);

could -theoretically- be placed into the diagram that the Instance reads from the bucket. Currently not even the bucket is made it onto the diagram

Same for other imported resources like Topic, Queue, Table, ..

tnx 🚀

As you said it looks like imported resources aren't diagramed.

This is tricky as cdk-dia diagrams according to the CDK Construct tree. In the Construct tree the imported bucket is represented as:

"my-bucket-import": {
            "id": "my-bucket",
            "path": "SoTsStack/my-bucket",
            "constructInfo": {
              "fqn": "@aws-cdk/core.Resource",
              "version": "1.102.0"
            }
          },

which provides no details about this being an imported resource and about its type (S3 Bucket).

Implementing this requires looking deeper into how CDK handles imports and figuring how can this be achieved.

Regarding showing in the diagram that this instance reads from the bucket, that's a great idea. I'll open it in another issue.