im2nguyen / rover

Interactive Terraform visualization. State and configuration explorer.
MIT License
3.02k stars 179 forks source link

Terraform Visualizer - Resources in the graph are on top of each other #28

Closed davetustin closed 3 years ago

davetustin commented 3 years ago

Hi,

This could be by design, but when I go to the Rover - Terraform Visualizer, all the resources are on top of each other in the centre of the graph.

Do I need to move these elements around manually or should it be done by Rover?

Thank you! Dave

im2nguyen commented 3 years ago

It should be done through rover. I'm thinking there was an error while building the graph. Can you open up your browser's console and paste the error messages?

bugblip commented 3 years ago

I'm also having the same issue, all the resource graph are on top of each other

davetustin commented 3 years ago

Hi,

The error in the console is below.

Uncaught (in promise) Error: Can not create edge `output.client_id->azuread_application.occm_application.application_id` with nonexistant target `azuread_application.occm_application.application_id`
    at Pe (vue-cytoscape.common.js:2465)
    at Xe.so.restore (vue-cytoscape.common.js:14039)
    at new Xe (vue-cytoscape.common.js:2877)
    at Ko.add (vue-cytoscape.common.js:14474)
    at Graph.vue:336
    at Array.forEach (<anonymous>)
    at o.renderGraph (Graph.vue:332)
    at Graph.vue:501

Thank you Dave

im2nguyen commented 3 years ago

Hello! https://github.com/im2nguyen/rover/pull/32 fixes this bug.

The bug was because the output referenced a resource attribute (azuread_application.occm_application.application_id) rather than the resource itself (azuread_application.occm_application). Updated rover so it ignores resource attributes when generating the graph, which fixed the issue when I reproduced it 😄

im2nguyen commented 3 years ago

This should be fixed with #32! Can you pull the latest Docker image and test it again? You can also re-download the binary 😄

docker pull im2nguyen/rover
davetustin commented 3 years ago

Hi,

Thanks for looking into so quickly. I downloaded v0.2.0 and tried it, I still get an error, but for another type of resource.

vue-cytoscape.common.js:2465 Uncaught (in promise) Error: Can not create edge `output.tenant_id->data.azurerm_subscription.current.tenant_id` with nonexistant target `data.azurerm_subscription.current.tenant_id`
    at Pe (vue-cytoscape.common.js:2465)
    at Xe.so.restore (vue-cytoscape.common.js:14039)
    at new Xe (vue-cytoscape.common.js:2877)
    at Ko.add (vue-cytoscape.common.js:14474)
    at Graph.vue:336
    at Array.forEach (<anonymous>)
    at o.renderGraph (Graph.vue:332)
    at Graph.vue:501

I am not using Docker, I am using rover_0.2.0_windows_amd64.zip.

Thanks again, Dave

im2nguyen commented 3 years ago

Hi @davetustin, are you sure you're using the latest version of rover? did you remove the previous version yet?

I just tried to replicate locally and it's working as expected. I added the following to example/random-test which should be similar to your configuration (output pointing to a data resource attribute).

data "http" "terraform_metadata" {
  url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"

  # Optional request headers
  request_headers = {
    Accept = "application/json"
  }
}

output "terraform_metadata" {
  description = "Terraform metadata"
  value = data.http.terraform_metadata.body
}
im2nguyen commented 3 years ago

Just released this version v0.2.1, which includes the -version flag!

$ rover -version
Rover v0.2.1
davetustin commented 3 years ago

I replaced the rover exe with the new one, restarted vscode just to make sure. I can't see any --version command which would be useful, Is there a way I can double check?

davetustin commented 3 years ago

Perfect timing! I am using v0.2.1 and the graph is now showing correctly. The only thing that I did notice is that the output in the terminal says it is running on 0.0.0.0:9000, rather than localhost:9000.

Looks like this did resolve it! Awesome work!

Thank for your efforts. Dave