Skip to content

Observed nodes carry the stack's exports as attributes, not their own properties #1279

Closed

Description

@lex00

Found while trying to answer "which instances are not in a default VPC" from the graph.

What a VPC node looks like

ec2-multiregion-…-us-east-1::vpc  physical=vpc-a5a41663
  attrs = expAmiName, expDefaultSubnet1, expDefaultSubnet2, expDefaultVpcId,
          expDefaultVpcInstanceId, expHttpPort, expInstanceId, expRoleName,
          expStackName, expUnusedSecurityGroupId, expVpcId, expWebIp, …

Those are the stack's CloudFormation exports, and every node in the stack carries the same set. The VPC has no CidrBlock, no IsDefault, no InstanceTenancy — none of its own properties.

The same thing was true of snapshots before #1267, for the same reason: resolveTemplateAttrs resolves the stack's outputs and they get attached to every resource in it.

Why it matters

  • "Is this the default VPC" is unanswerable. AWS returns IsDefault on describe-vpcs; nothing carries it into the graph. An agent gets the right answer today by recognising the string vpc-default, which is luck — it breaks on any estate where the default VPC is not conveniently named.
  • Every property question about a non-instance resource has the same hole. A subnet's MapPublicIpOnLaunch, a route table's routes, a VPC's CIDR: the folds reach them through dependency observation (Observe the dependencies a declared estate references, not just what it manages #1273) or the deep path (Deep snapshots: record the property trees the folds need, not just identity #1267), and a plain attr: query on an observed node does not.
  • It bloats every node. 27 identical export attributes per node, repeated across the stack, in every graph dump an agent reads.

What the shape should be

A node's attrs should be that resource's own properties. Stack exports are stack-level and belong once, on the stack or the graph, not copied onto every member.

Both halves already exist elsewhere: observeDependencies (#1273) and observeAmbient (#1278) attach real per-resource payloads, and the deep path (#1267) records normalized property trees. What is missing is the managed thin path doing the same, instead of falling back to template outputs.

Bounding it

This is a change to what an observed node is, so it touches the overlay, graph --live, drift and behold. Worth deciding deliberately rather than adjusting resolveTemplateAttrs in place:

  • do exports move to a stack-level field, or stay available under a prefix?
  • does the thin path gain a per-resource read, or is that what deep depth is for?
  • what does an existing snapshot's attributes mean once the shape changes?

Not urgent

The benchmark tasks that touch it are answered today by other means, so nothing is blocked. It is the reason a whole class of attr: query silently returns nothing useful, which is worth fixing before someone relies on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area:lifecyclebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions