awslabs / diagram-as-code

Diagram-as-code for AWS architecture.
Apache License 2.0
405 stars 22 forks source link

Refactor processing to convert CFn template to struct data #55

Closed a2ush closed 1 month ago

a2ush commented 1 month ago

Issue #, if available:

There is the issue where an unintended resource was regarded as the parent, which caused it to not be drawn properly.

Description of changes:

This commit refactors the processing to convert CloudFormation (CFn) templates to struct data. The changes ensure that only valid resources can be treated as parents. Resources that do not meet the criteria for being a parent (e.g., missing required fields or invalid type) are removed from the list of potential parents.

Additionally, resources that do not have an explicitly defined parent are now assigned to the "AWSCloud" resource by default. This ensures that all resources are properly organized within the hierarchy.

These changes improve the overall structure and organization of the resource data, making it easier to work with and preventing potential issues caused by invalid or orphaned resources.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.