[GH-ISSUE #116] KeyError: 'edges' #61

Closed
opened 2026-05-06 12:36:56 +02:00 by BreizhHardware · 4 comments

Originally created by @patrickmlvn on GitHub (Apr 14, 2024).
Original GitHub issue: https://github.com/patrickchugh/terravision/issues/116

Checking out terravision for the first time and running into the following issue with a simple Azure Resource Group Terraform file.

My environment:
OS: MacOS Sonoma 14.4.1
terravision Version: 0.5
pyenv Version: 2.4.0
python3 Version: 3.10.14

> terravision draw --debug

[sic]

Analysing plan..

Traceback (most recent call last):
  File "~/terravision/terravision", line 265, in <module>
    cli(
  File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "~/terravision/terravision", line 188, in draw
    tfdata = compile_tfdata(source, varfile, workspace, debug, annotate)
  File "~/terravision/terravision", line 48, in compile_tfdata
    tfdata = tfwrapper.tf_makegraph(tfdata)
  File "~/terravision/modules/tfwrapper.py", line 200, in tf_makegraph
    for connection in tfdata["tfgraph"]["edges"]:
KeyError: 'edges'
Originally created by @patrickmlvn on GitHub (Apr 14, 2024). Original GitHub issue: https://github.com/patrickchugh/terravision/issues/116 Checking out terravision for the first time and running into the following issue with a simple Azure Resource Group Terraform file. My environment: **OS**: MacOS Sonoma 14.4.1 **terravision Version**: 0.5 **pyenv Version**: 2.4.0 **python3 Version**: 3.10.14 ```shell > terravision draw --debug [sic] Analysing plan.. Traceback (most recent call last): File "~/terravision/terravision", line 265, in <module> cli( File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "~/terravision/terravision", line 188, in draw tfdata = compile_tfdata(source, varfile, workspace, debug, annotate) File "~/terravision/terravision", line 48, in compile_tfdata tfdata = tfwrapper.tf_makegraph(tfdata) File "~/terravision/modules/tfwrapper.py", line 200, in tf_makegraph for connection in tfdata["tfgraph"]["edges"]: KeyError: 'edges' ```
Author
Owner

@patrickchugh commented on GitHub (May 11, 2024):

Thanks for the bug report. Can you confirm if this still exists with the latest release pushed just now?

<!-- gh-comment-id:2106017466 --> @patrickchugh commented on GitHub (May 11, 2024): Thanks for the bug report. Can you confirm if this still exists with the latest release pushed just now?
Author
Owner

@patrickmlvn commented on GitHub (May 12, 2024):

You're welcome. Upgraded to terravision 0.6 and re-ran the command but still running into an issue, looks like the debug is slightly different now:

[sic]

Analysing plan..


Converting TF Graph Connections..  (this may take a while)

Traceback (most recent call last):
  File "~/git/macos/terravision/terravision", line 289, in <module>
    cli(
  File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "~/git/macos/terravision/terravision", line 207, in draw
    tfdata = compile_tfdata(source, varfile, workspace, debug, annotate)
  File "~/git/macos/terravision/terravision", line 50, in compile_tfdata
    tfdata = tfwrapper.tf_makegraph(tfdata)
  File "~/git/macos/terravision/modules/tfwrapper.py", line 220, in tf_makegraph
    for connection in tfdata["tfgraph"]["edges"]:
KeyError: 'edges'
<!-- gh-comment-id:2106290728 --> @patrickmlvn commented on GitHub (May 12, 2024): You're welcome. Upgraded to terravision 0.6 and re-ran the command but still running into an issue, looks like the debug is slightly different now: ``` [sic] Analysing plan.. Converting TF Graph Connections.. (this may take a while) Traceback (most recent call last): File "~/git/macos/terravision/terravision", line 289, in <module> cli( File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "~/.pyenv/versions/3.10.14/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "~/git/macos/terravision/terravision", line 207, in draw tfdata = compile_tfdata(source, varfile, workspace, debug, annotate) File "~/git/macos/terravision/terravision", line 50, in compile_tfdata tfdata = tfwrapper.tf_makegraph(tfdata) File "~/git/macos/terravision/modules/tfwrapper.py", line 220, in tf_makegraph for connection in tfdata["tfgraph"]["edges"]: KeyError: 'edges' ```
Author
Owner

@patrickchugh commented on GitHub (May 12, 2024):

It's very peculiar that your tf graph output doesn't have any edges? I made some modification to check for the edges. Please try again and if it doesn't work can you share your Terraform source with me so I can try to reproduce the error?

<!-- gh-comment-id:2106372342 --> @patrickchugh commented on GitHub (May 12, 2024): It's very peculiar that your tf graph output doesn't have any edges? I made some modification to check for the edges. Please try again and if it doesn't work can you share your Terraform source with me so I can try to reproduce the error?
Author
Owner

@patrickmlvn commented on GitHub (May 13, 2024):

Thanks for the update. Pulled the latest changes in main and I am no longer receiving the edges error. However, I do receive this error:

error
> terravision draw --debug

[sic]

Decoding plan..


Analysing plan..


Converting TF Graph Connections..  (this may take a while)


ERROR: No AWS, Azure or Google resources will be created with current plan. Exiting.

It could still be a user error on my end, but I tried with just a simple Azure Resource Group creation, as well as a Resource Group, VNET, and NSG. I also tried with a clean environment (removed .terraform/ and .terraform.lock.hcl) with no change.

Just to rule out how/where I was running terravision, all of my attempts have been from within the directory that contains my terraform code. I also tried running from the terravision directory and supplying the --source parameter with no change in the error.

Below, you can see that terraform plan that terravision is executing does see changes to apply:

Generating Terraform Plan..
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_resource_group.this will be created
  + resource "azurerm_resource_group" "this" {
      + id       = (known after apply)
      + location = "centralus"
      + name     = "sandbox-cus-rsg"
      + tags     = {
          + "environment" = "sandbox"
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

If it would still be helpful, I've included the terraform code below (if you need the provider, or any other info, let me know).

main.tf
resource "azurerm_resource_group" "this" { 
  name     = "sandbox-cus-rsg"
  location = "centralus"

  tags = {
    environment = "sandbox"
  }
}
<!-- gh-comment-id:2108089726 --> @patrickmlvn commented on GitHub (May 13, 2024): Thanks for the update. Pulled the latest changes in `main` and I am no longer receiving the `edges` error. However, I do receive this error: <details> <summary>error</summary> ``` > terravision draw --debug [sic] Decoding plan.. Analysing plan.. Converting TF Graph Connections.. (this may take a while) ERROR: No AWS, Azure or Google resources will be created with current plan. Exiting. ``` </details> It could still be a user error on my end, but I tried with just a simple Azure Resource Group creation, as well as a Resource Group, VNET, and NSG. I also tried with a clean environment (removed `.terraform/` and `.terraform.lock.hcl`) with no change. Just to rule out how/where I was running `terravision`, all of my attempts have been from within the directory that contains my terraform code. I also tried running from the `terravision` directory and supplying the `--source` parameter with no change in the error. Below, you can see that `terraform plan` that `terravision` is executing does see changes to apply: <details> <summary>Generating Terraform Plan..</summary> ```hcl Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # azurerm_resource_group.this will be created + resource "azurerm_resource_group" "this" { + id = (known after apply) + location = "centralus" + name = "sandbox-cus-rsg" + tags = { + "environment" = "sandbox" } } Plan: 1 to add, 0 to change, 0 to destroy. ``` </details> If it would still be helpful, I've included the terraform code below (if you need the provider, or any other info, let me know). <details> <summary>main.tf</summary> ```hcl resource "azurerm_resource_group" "this" { name = "sandbox-cus-rsg" location = "centralus" tags = { environment = "sandbox" } } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/terravision#61
No description provided.