Skip to content

Reference connections outside of file #2643

@davispuh

Description

@davispuh

I want to model/draw whole infrastructure once and then render it in different views/levels (details).

Consider this example

DatacenterA: {
  NodeA: {
    VPNServer <-> _._.DatacenterB.NodeB.VPNServer: Site-to-Site VPN
  }
}

DatacenterB: {
  NodeB: {
    VPNServer
  }
}

I want to split DatacenterA in separate file DatacenterA.d2 and DatacenterB in DatacenterB.d2 but currently it's not possible because I can't reference outside of file.

DatacenterA.d2: invalid underscore

The use case is using it like this

# High-level overview

# Include everything
...@DatacenterA
...@DatacenterB

# Hide details
DatacenterA.NodeA.*: suspend
DatacenterB.NodeB.*: suspend

# Add high level connections
DatacenterA.NodeA -> DatacenterB.NodeB

DatacenterA.link: layers.Detailed
DatacenterB.link: layers.Detailed

layers: {
  Detailed: {
    # Most detailed - don't hide anything
    ...@DatacenterA
    ...@DatacenterB
  }
}

This would allow me to render everything with single source of truth.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions