Skip to content

GCP compute graph relationships are missing instance and disk edges #2333

@drwicid

Description

@drwicid

Description

Summary

The GCP plugin parses relationship-shaped fields in compute resources but does not consistently materialize them as graph edges. Two confirmed gaps are:

  • GcpAddress.users does not create an instance -> address edge.
  • GcpInstance.disks[].source does not create an instance -> disk edge.

This leaves graph traversal incomplete and causes selectors or reports that depend on graph edges to miss real GCP relationships.

Impact

  • Attached disks can appear disconnected from the instances that use them.
  • Reserved or attached addresses can appear unlinked from the instances that consume them.
  • Traversal-based queries underreport valid compute relationships.

Affected Files And Changes

  • plugins/gcp/fix_plugin_gcp/resources/compute.py
    • Add gcp_instance to GcpAddress predecessor metadata.
    • Update GcpAddress.connect_in_graph() to convert users into instance-to-address edges.
    • Update GcpInstance.connect_in_graph() to convert attached disk source links into instance-to-disk edges.
  • plugins/gcp/test/test_compute.py
    • Add regression coverage for address user linkage.
    • Add regression coverage for attached disk linkage.

Expected Behavior

  • GcpAddress.users should create a graph edge from the referenced instance to the address.
  • GcpInstance.disks[].source should create a graph edge from the instance to each referenced disk.
  • Duplicate relationship reports should still resolve cleanly at the graph layer.

Version

v4.3.0

Environment

Docker

Steps to Reproduce

  1. Collect inventory
  2. Query for disks attached to an instance: search for is(gcp_disk) with (any, <-- is(gcp_instance))
  3. Observe that no results are returned when cloud environment has instances with disks attached.

Logs

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions