Skip to content

fix: logical groups from terravision.yml work when drawing from Terraform - #224

Merged
patrickchugh merged 1 commit into
mainfrom
feat/annotation-groups
Oct 2, 2026
Merged

patrickchugh merged 1 commit into
mainfrom
feat/annotation-groups

Conversation

@patrickchugh

Copy link
Copy Markdown
Owner

Summary

A group added in terravision.yml (aws_group, azurerm_group or tv_gcp_logical_group) is now drawn around its resources when drawing from Terraform. Before, the log said the group was applied, but the diagram showed an empty, squashed box and the resources stayed where they were.

Root cause

Three later pipeline steps undid the annotation:

  • The automatic Lambda group (auto_group_by_type) took the Lambdas out of the user's group.
  • reverse_relations treated the group's containment of a Step Functions state machine (a "forced origin") as an arrow, and reversed it.
  • On Azure, the resource group claimed the members first, leaving the group box empty.

Changes

  • reverse_relations skips container nodes.
  • auto_group_by_type and group_shared_services leave alone resources that already sit in a user group.
  • New last pipeline step, graphmaker.place_annotation_groups: it puts the group inside the innermost container its members share, and takes the members out of automatic groups. An automatic group left empty is not drawn. If a member also sits in a box the group is not inside, it stays there and a warning names it.
  • New per-provider constant <P>_LOGICAL_GROUP_NODES.
  • docs/annotations.md: new "Group Resources" section with an example.

Tests

  • tests/test_annotation_groups.py: 20 tests (unit tests, debug replays, and one slow test running a real terraform plan on the Step Functions fixture with mock credentials).
  • Full suite, slow tests included: 2204 passed.
  • No tests/json/expected-*.json changed, and nothing under skills/ changed.

🤖 Generated with Claude Code

…form

An annotation that declared aws_group.<name> and connected resources to it
drew an empty, squashed box. Three steps undid the user's group:

- auto_group_by_type moved the Lambdas out of every group node, the user's
  included, into aws_group.aws_lambda_function and nested that inside it
- reverse_relations treated the group's containment of the state machine
  (a FORCED_ORIGIN type) as an arrow and reversed it
- on Azure, members also stayed in the resource group, which is drawn first
  and claims them, so the group box was empty

Fix:
- reverse_relations skips container nodes: their lists are containment
- group_shared_services and auto_group_by_type leave alone resources that
  already sit in another group of the same type (a user group)
- new graphmaker.place_annotation_groups, run last in the pipeline, takes
  members out of automatic groups (removing any left empty), nests the
  group in the innermost container its members share, and drops a member
  that also sits in a container outside the group, with a warning
- LOGICAL_GROUP_NODES per provider names the generic box: aws_group,
  azurerm_group, tv_gcp_logical_group

No expected-*.json changes. Docs: annotations guide gains a Group
Resources section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
patrickchugh added a commit that referenced this pull request Oct 2, 2026
…-groups)

Logical groups from terravision.yml in Terraform mode (PR #224), and
rendering fixes: networks nest in region and account boxes, the title
clears top-level boxes, labels keep repeated words the author chose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@patrickchugh
patrickchugh merged commit 3fb641d into main Oct 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant