Pluralith / pluralith-cli

A tool for Terraform state visualisation and automated generation of infrastructure documentation
https://www.pluralith.com
Mozilla Public License 2.0
785 stars 54 forks source link

BUG: Unable to `unrelate` objects with key (`for_each`) #111

Open sterliakov opened 1 year ago

sterliakov commented 1 year ago

With the following config file piece:

...
diagram:
  unrelate:
    - resource1: ml_instances.aws_eip.eipalloc-08623772f2cbfd669
      resource2: ml_instances.aws_instance.ml_ireland.a
    - resource1: ml_instances.aws_eip.eipalloc-08623772f2cbfd669
      resource2: ml_instances.aws_instance.ml_ireland.b
    - resource1: ml_instances.aws_eip.eipalloc-08623772f2cbfd669
      resource2: ml_instances.aws_instance.ml_ireland.c
    - resource1: ml_instances.aws_eip.eipalloc-08623772f2cbfd669
      resource2: ml_instances.aws_instance.ml_ireland.d
    - resource1: ml_instances.aws_eip.eipalloc-08623772f2cbfd669
      resource2: ml_instances.aws_instance.ml_ireland.e
    - resource1: ml_instances.aws_eip.eipalloc-08623772f2cbfd669
      resource2: ml_instances.aws_instance.ml_ireland.f
    - resource1: ml_instances.aws_eip.eipalloc-08623772f2cbfd669
      resource2: ml_instances.aws_instance.ml_ireland.g

All the links are still generated. In pluralith.diagram.json I see this unrelate items listed. In pluralith.cache.json:


        {
            "childResourceId": "0.ml_instances.aws_eip.eipalloc-08623772f2cbfd669",
            "parentResourceId": "0.ml_instances.aws_instance.ml_ireland.f",
            "path": [
            {
                "xStart": 104,
                "yStart": 150,
                "xEnd": 103,
                "yEnd": 150
            },
            {
                "xStart": 103,
                "yStart": 150,
                "xEnd": 57,
                "yEnd": 154
            },
            {
                "xStart": 57,
                "yStart": 154,
                "xEnd": 56,
                "yEnd": 154
            }],
            "svgPath": "M 104 150 L 104 150 C 103.5 150 102.00375941180431 150.08662961636486 101.00751882360863 150.1732592327297 L 58.992481176391365 153.8267407672703 C 57.99624058819568 153.91337038363514 56.5 154 56 154 L 56 154 ",
            "id": 58
        },
        {
            "childResourceId": "0.ml_instances.aws_eip.eipalloc-08623772f2cbfd669",
            "parentResourceId": "0.ml_instances.aws_instance.ml_ireland.e",
            "path": [
            {
                "xStart": 104,
                "yStart": 145,
                "xEnd": 103,
                "yEnd": 145
            },
            {
                "xStart": 103,
                "yStart": 145,
                "xEnd": 57,
                "yEnd": 154
            },
            {
                "xStart": 57,
                "yStart": 154,
                "xEnd": 56,
                "yEnd": 154
            }],
            "svgPath": "M 104 145 L 104 145 C 103.5 145 102.01860734513997 145.19201160638568 101.03721469027995 145.38402321277133 L 58.96278530972004 153.61597678722867 C 57.98139265486002 153.80798839361432 56.5 154 56 154 L 56 154 ",
            "id": 59
        },

These edges are still present for some reason. In actual tf files eip is connected only with ml_instances.aws_instance.ml_ireland.f, but I'm OK with wrong paths drawn as long as I can manually remove them (I have 300 lines of config to make diagram look nice anyway).

DanThePutzer commented 1 year ago

@sterliakov Thank you for reporting! We'll look into it and see if we can get this fixed up! 👍