DEV Community

Raghvendra Pandey
Raghvendra Pandey

Posted on • Edited on • Originally published at infrasketch.cloud

Pulumi Diagram Generator — Visualize Pulumi Infrastructure Instantly

InfraSketch now supports Pulumi. Paste your Pulumi TypeScript or Python code into the Pulumi tab and get a full architecture diagram in seconds — VPC containment, subnet grouping, resource connections, official AWS, GCP, and Azure icons. No login, no credentials, everything runs in your browser.

Try it now Paste your Pulumi TypeScript or Python code and see the diagram instantly. Open InfraSketch →

Why Pulumi needs a diagram tool

Pulumi lets you write infrastructure in real programming languages — TypeScript, Python, Go, C#. That's great for developer productivity, but it creates the same visibility problem every IaC tool has: your infrastructure lives in code, not in a picture. When a new engineer joins the team, or when you're reviewing a PR that adds a VPC and six new resources, reading TypeScript is not the fastest way to understand what gets built.

Unlike Terraform's HCL, Pulumi code doesn't have a declarative format that's easy to inspect at a glance. A function might conditionally create resources. Loops might generate dozens of similar components. The Pulumi console shows state, not topology. There's no built-in way to go from code to architecture diagram.

InfraSketch parses Pulumi TypeScript and Python directly — no compile step, no export, just paste and generate.

How to use it

Open infrasketch.cloud, click the Pulumi tab, paste your index.ts or __main__.py file, and click Generate Diagram. You can paste a partial file — InfraSketch handles incomplete code gracefully.

// Example: paste this into the Pulumi tab
import * as aws from "@pulumi/aws";

const vpc = new aws.ec2.Vpc("main", { cidrBlock: "10.0.0.0/16" });
const subnet = new aws.ec2.Subnet("public", {
vpcId: vpc.id,
cidrBlock: "10.0.1.0/24",
});
const igw = new aws.ec2.InternetGateway("igw", { vpcId: vpc.id });
const lb = new aws.lb.LoadBalancer("alb", { subnets: [subnet.id] });
Enter fullscreen mode Exit fullscreen mode

Tip: Pulumi Python uses the same resource types with underscores — aws.ec2.Vpc in TypeScript is aws.ec2.Vpc in Python too. Both work with InfraSketch.

What gets visualized

VPC containment

Resources referencing a VPC via vpcId: vpc.id are drawn inside the VPC boundary automatically.

Subnet placement

Resources with subnetId or subnets arguments are placed in public or private subnet lanes.

Connection arrows

Variable references between resources — vpc.id, cluster.endpoint — become directed arrows on the diagram.

Multi-cloud

AWS, GCP, and Azure resources in the same stack all render on one diagram with their respective provider icons.

Supported Pulumi resource types

InfraSketch supports 95+ Pulumi resource types across AWS, GCP, and Azure. Key AWS resources include:

  • Networking: aws.ec2.Vpc, aws.ec2.Subnet, aws.ec2.InternetGateway, aws.ec2.NatGateway, aws.ec2.SecurityGroup, aws.ec2.TransitGateway
  • Compute: aws.ec2.Instance, aws.ec2.LaunchTemplate, aws.autoscaling.Group, aws.ecs.Cluster, aws.ecs.Service, aws.lambda_.Function
  • Containers: aws.eks.Cluster, aws.eks.NodeGroup, aws.ecr.Repository
  • Load balancing: aws.lb.LoadBalancer, aws.lb.TargetGroup, aws.alb.LoadBalancer
  • Data: aws.rds.Instance, aws.rds.Cluster, aws.dynamodb.Table, aws.elasticache.Cluster, aws.s3.Bucket
  • Messaging: aws.sqs.Queue, aws.sns.Topic
  • DNS & CDN: aws.route53.Zone, aws.cloudfront.Distribution
  • Security: aws.iam.Role, aws.kms.Key, aws.wafv2.WebAcl

GCP resources cover Compute Engine, GKE, Cloud Run, Cloud Functions, Cloud SQL, BigQuery, Spanner, Bigtable, Pub/Sub, Cloud Storage, Secret Manager, and more. Azure covers Virtual Networks, AKS, App Service, Functions, SQL, Cosmos DB, and Key Vault.

TypeScript vs Python

InfraSketch detects the language automatically. TypeScript uses camelCase arguments (cidrBlock, vpcId). Python uses snake_case (cidr_block, vpc_id). Both parse correctly — no pre-processing needed.

# Python example — works the same way
import pulumi_aws as aws

vpc = aws.ec2.Vpc("main", cidr_block="10.0.0.0/16")
subnet = aws.ec2.Subnet("public",
vpc_id=vpc.id,
cidr_block="10.0.1.0/24"
)
cluster = aws.eks.Cluster("eks", vpc_config=aws.eks.ClusterVpcConfigArgs(
subnet_ids=[subnet.id]
))
Enter fullscreen mode Exit fullscreen mode

Use cases

  • Code reviews — paste a PR's Pulumi code and see the topology change visually before approving
  • Onboarding — share a diagram link instead of asking new engineers to read TypeScript they've never seen
  • Documentation — export as PNG or SVG and embed in Confluence, Notion, or your wiki
  • Architecture reviews — export as draw.io XML for a fully editable diagram in your design doc
  • Multi-stack visibility — paste each stack separately and compare their architectures side by side

GCP resources with Pulumi

InfraSketch maps Pulumi GCP resources using the @pulumi/gcp (TypeScript) and pulumi_gcp (Python) providers. Supported GCP types include:

  • Networking: gcp.compute.Network, gcp.compute.Subnetwork, gcp.compute.Router, gcp.compute.GlobalAddress
  • Compute: gcp.compute.Instance, gcp.container.Cluster (GKE), gcp.cloudrun.Service, gcp.cloudfunctions.Function
  • Data: gcp.sql.DatabaseInstance, gcp.bigquery.Dataset, gcp.spanner.Instance, gcp.bigtable.Instance, gcp.storage.Bucket, gcp.firestore.Database
  • Messaging: gcp.pubsub.Topic, gcp.pubsub.Subscription
  • Security: gcp.kms.KeyRing, gcp.secretmanager.Secret, gcp.serviceaccount.Account
// GCP Pulumi example
import * as gcp from "@pulumi/gcp";

const network = new gcp.compute.Network("vpc", { autoCreateSubnetworks: false });
const subnet = new gcp.compute.Subnetwork("subnet", {
network: network.id,
ipCidrRange: "10.0.0.0/24",
});
const cluster = new gcp.container.Cluster("gke", {
network: network.name,
subnetwork: subnet.name,
});
Enter fullscreen mode Exit fullscreen mode

Azure resources with Pulumi

Pulumi supports Azure via two providers: the classic @pulumi/azure (wraps Terraform AzureRM) and the native @pulumi/azure-native (generated directly from the ARM API). InfraSketch supports the classic provider's azurerm_* resource types through Pulumi's wrapping — pass Azure Classic Pulumi code and VNets, AKS clusters, App Services, SQL servers, and Key Vaults all render correctly.

Pulumi ComponentResource and abstractions

ComponentResource is Pulumi's way of grouping resources into reusable abstractions — similar to CDK Constructs. A ComponentResource might wrap a VPC, security groups, and route tables into a single "Network" abstraction. InfraSketch parses the resources at the leaf level (the actual aws.ec2.Vpc, aws.ec2.SecurityGroup calls inside the component), not at the component level, so you see the underlying resources on the diagram even if they're created inside a ComponentResource.

Pulumi vs CDK diagrams

Both Pulumi and CDK let you write infrastructure in TypeScript. The key difference for diagramming:

  • Pulumi: Paste source code directly — InfraSketch parses the TypeScript or Python text. No compilation step needed. Works best with files under ~500 lines; very large stacks may have resources that fall outside the parsed window.
  • CDK: Requires a cdk synth step first. The synthesized JSON is more complete and deterministic — every resource CDK creates, including automatically-generated IAM roles and security groups, appears in the output. CDK diagrams tend to show more nodes than Pulumi diagrams for equivalent infrastructure.

If you need the most accurate diagram, CDK wins because synthesis resolves all abstractions. If you want to paste and go without running any commands, Pulumi wins.

Frequently asked questions

Does InfraSketch support Pulumi Go or C#?

Not yet. The parser targets TypeScript (.ts) and Python (.py) syntax specifically. Go and C# support is on the roadmap. TypeScript is the most widely used Pulumi language, and Python is second.

What if my Pulumi code uses variables and loops?

InfraSketch uses regex-based parsing rather than evaluating the code. Resources created inside for loops will be detected but may appear as a single node (only the first loop iteration's resource constructor is matched). Static resource declarations work fully. Conditional resources (if (isProd) new aws.rds.Instance(...) appear in the diagram regardless of the condition value.

Can I paste multiple Pulumi files?

Yes — paste the contents of multiple files concatenated together. InfraSketch scans the entire input for resource constructors. If two files reference the same variable name for different resources, connections may link incorrectly, so it's best to paste one file at a time for large stacks.

Pulumi vs Terraform diagrams

If you're migrating from Terraform to Pulumi (or evaluating it), InfraSketch lets you diagram both. Paste your Terraform HCL in the Terraform tab and your equivalent Pulumi code in the Pulumi tab — the diagrams should look identical if the migration is complete. Differences become immediately visible.

Generate your Pulumi diagram now Paste your index.ts or __main__.py into the Pulumi tab. Free, no login, nothing leaves your browser. Open InfraSketch →

Top comments (0)