hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.42k stars 9.5k forks source link

Terraform graph includes root elements #16608

Closed xpolb01 closed 6 years ago

xpolb01 commented 6 years ago

Terraform graph includes too many elements. Actual: graph

Expected:

screen shot 2017-11-09 at 1 39 22 pm
apparentlymart commented 6 years ago

Hi @xpolb01! Thanks for reporting this.

We're aware that a few implementation details (like the "meta.count-boundary" node) are currently leaking into the graph output; this is covered by #14511.

You also removed from your "expected" graph many things that are intentionally present, though: module variables and outputs are important participants in the graph (they include interpolation expressions) and the resources from child modules are illustrated as such (with the module.foo. prefix) because they can have conflicting names with resources in the root.

The [root] prefix showing up here is a bug, resulting from the fact that not all of the graph nodes have a proper implementation of graph caption. That's not explicitly captured by #14511 but when we get to that we will be doing a holistic cleanup of the graph output that will cover this too.

Since we already have #14511 open, I'm going to close this just to consolidate the discussion over there. Unfortunately since the graph functionality is not "core workflow" it is, naturally, lower priority than other UX improvements we might make, but we do intend to eventually rework how it's constructed to focus on details that are interesting to users, rather than details about Terraform's implementation.

xpolb01 commented 6 years ago

@apparentlymart Thanks a lot for very clear explanation!

dmitrytokarev commented 6 years ago

@xpolb01 see if this helps - https://github.com/hashicorp/terraform/issues/14511#issuecomment-366505121

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.