Repository navigation
Conversation
References through `local.*` were dropped when collecting dependencies,
so a resource using `compartment_id = local.compartment_id` (where the
local reads a data source or another resource) got no edge. For configs
that route values through locals, the graph was mostly disconnected:
`oxid graph` under-reported dependencies and plan/apply ordering missed
real ones.
- Keep `local.<name>` references (expressions and `${}` in nested blocks)
- Resolve each local to the resource and data source addresses it
reaches, following locals that reference other locals; cycles between
locals are cut instead of looping
- Expand local references for resource, data source and output edges
- Include references in `count` and `for_each`, not only attributes
- Fix data source DOT labels, which were prefixed twice (`data.data.`)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The DAG builder evaluates count and for_each with variables only. When they depend on locals, resources or data sources (e.g. `count = length(local.dbs)`), the expression evaluated against nulls: length() returned 0 and toset() an empty set, so the resource got zero instances and silently disappeared from the graph. Treat such expressions as not statically known and keep the resource as a single unindexed node, as is already done when for_each evaluates to null. Its dependencies are still tracked through the count/for_each references. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Modules are opaque to the resource graph, so `oxid graph` left out every
module call. Configurations built mostly from modules rendered as a few
disconnected data sources, and resources fed by module outputs had no
incoming edges.
- Collect `module.<name>` references (expressions and `${}` in nested
blocks); they still don't resolve to nodes in the execution graph
- Add to_dot_with_modules, used by `oxid graph`: each module call is a
node labelled with a short form of its source, linked from what its
arguments reference and to the resources, data sources, outputs and
modules that use its outputs, including through locals
- Factor resource reference collection into resource_references
Plan and apply are unchanged; module contents are still not expanded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
@ftgonc approved workflows |
Contributor
|
@ftgonc most of the PRs security and clippy failed. Could you test this again? |
Contributor
|
@ftgonc checking in here again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modules are opaque to the resource graph, so
oxid graphleaves out everymodulecall. Configurations built mostly from modules render as a handful of disconnected data sources, and resources that consume module outputs have no incoming edges.This adds module calls to the
oxid graphoutput without expanding them:module.<name>references, both in expressions and in${…}interpolations inside nested blocks. In the execution graph they still don't resolve to any node, so plan and apply are unchangedto_dot_with_modules, used byoxid graph: each module call becomes a node (shape=component) labelled with its name and a short form of its source (git::https://host/repo.git//database?ref=v1→database; local and registry sources are shown as-is)count,for_eachanddepends_on) reference, and to the resources, data sources, outputs and modules that use its outputs. Both directions follow locals, using the resolution from fix: follow local values when building the resource graph #13resource_references, shared by the DAG builder and the DOT outputOut of scope
blast-radiusoroxid graph -T moduleTest plan
tests/resource_graph_test.rs: module node label and shape with a git source and a local source; edges data source → module (through a local), module → module (through aforover module instances), module → resource (viacountand attributes through a local), module → output;to_dot(plan/apply graph) gains no module nodes; config without modules renders the same asto_dotcargo fmt --all -- --checkcleancargo clippy --all-targets -- -D warnings: no new findings. Current stable clippy reports 33 pre-existingdouble_must_useerrors insrc/state/backend.rsonmainas well, untouched here