Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- exports: pptx follows standards more closely, addressing warnings from some Powerpoint software [#2645](https://github.com/terrastruct/d2/pull/2645)
- d2sequence: fix edge case of invalid sequence diagrams [#2660](https://github.com/terrastruct/d2/pull/2660)
- d2svg: Text may overflow legend bounds when monospace font is used [#2674](https://github.com/terrastruct/d2/pull/2674)
- d2svg: markdown labels with Unicode punctuation no longer wrap unexpectedly [#2647](https://github.com/terrastruct/d2/issues/2647)

---

Expand Down
127 changes: 127 additions & 0 deletions docs/examples/cloud-run-egress/cloud-run-egress.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
title: {
shape: text
label: |md
# Cloud Run Egress Architecture — Backend / Exporter / Autolayout / Fetcher
|
near: top-center
}

Cloud_Run_Services: {
label: "Cloud Run Services"
style: {
fill: "#fbfbfd"
}

Backend: {
label: "Backend\n(tag: egress-web)\nDirect VPC egress: ALL_TRAFFIC"
style: {fill: "#e8f0fe"}
}

Exporter: {
label: "Exporter\n(tag: egress-sentry)\nDirect VPC egress: ALL_TRAFFIC"
style: {fill: "#e7f8ef"}
}

Autolayout: {
label: "Autolayout\n(tag: egress-none)\nDirect VPC egress: ALL_TRAFFIC"
style: {fill: "#fdeee8"}
}

Fetcher: {
label: "Fetcher\n(tag: egress-fetcher)\nDirect VPC egress: ALL_TRAFFIC"
style: {fill: "#fff7cc"}
}
}

VPC: {
label: "Your VPC (firewall / routes apply here)"
style: {
fill: "#f4f6fb"
}

FW: {
shape: page
label: |md
## Egress Firewall Policies

- Allow DNS (UDP/TCP 53) → 169.254.169.254
- Deny Metadata (TCP 80/443) → 169.254.169.254
- Allow → SWP VIP:80,443 (for tags: egress-web, egress-sentry, egress-fetcher)
- Allow private RFC1918/required backends (optional)
- Deny-All catch-all (per tag; e.g., egress-none)
|
}

SWP: {
label: "Secure Web Proxy (SWP)\nExplicit HTTP/HTTPS proxy\n(domain/URL policy, logs)"
shape: cylinder
}

NAT: {
label: "Cloud NAT\nEgress IPs to Internet"
shape: cylinder
}
}

Internet: {
shape: cloud
label: "Internet"
}

Sentry: {
label: "sentry.io"
}

ImageHosts: {
label: "Any image hosts"
}

# Ingress constraints to Autolayout (IAM-based)
Cloud_Run_Services.Backend -> Cloud_Run_Services.Autolayout: {
label: "ingress (Run Invoker SA)"
style: {stroke-dash: 3}
}

Cloud_Run_Services.Exporter -> Cloud_Run_Services.Autolayout: {
label: "ingress (Run Invoker SA)"
style: {stroke-dash: 3}
}

# Backend calls Fetcher for arbitrary image fetching
Cloud_Run_Services.Backend -> Cloud_Run_Services.Fetcher: {
label: "HTTPS (OIDC) call for image fetching"
style: {stroke-dash: 3}
}

# Service egress paths into VPC and through SWP
Cloud_Run_Services.Backend -> VPC.SWP: "via VPC FW → SWP"
Cloud_Run_Services.Exporter -> VPC.SWP: "via VPC FW → SWP"
Cloud_Run_Services.Fetcher -> VPC.SWP: "via VPC FW → SWP"

# Autolayout egress explicitly denied
Cloud_Run_Services.Autolayout -> VPC.FW: {
label: "egress denied"
style: {stroke-dash: 3; stroke: "#cc0000"}
}

# SWP to NAT to Internet
VPC.SWP -> VPC.NAT: ""
VPC.NAT -> Internet: ""

# Internet to SaaS destinations
Internet -> Sentry: ""
Internet -> ImageHosts: ""

# SWP policy notes
PolicyNotes: {
shape: page
label: |md
## SWP Policy Examples

- Source = Exporter SA → allow *.sentry.io only
- Source = Backend SA → allow broader HTTPS (still block RFC1918/link-local)
- Source = Fetcher SA (optional) → general web allow with deny lists
|
}

VPC.FW -> PolicyNotes: {style: {stroke-dash: 3}}
869 changes: 869 additions & 0 deletions docs/examples/cloud-run-egress/cloud-run-egress.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions e2etests/stable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2060,6 +2060,16 @@ i am bottom right: { shape: text; near: bottom-right }
poll the people -> results
results -> unfavorable -> poll the people
results -> favorable -> will of the people
`,
},
{
name: "unicode_markdown_title",
justDagre: true,
script: `title: |md
# Cloud Run Egress Architecture — Backend / Exporter / Autolayout / Fetcher
| { near: top-center }

x -> y
`,
},
{
Expand Down
232 changes: 232 additions & 0 deletions e2etests/testdata/stable/unicode_markdown_title/dagre/board.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading