ConfigsApr 11, 2026·3 min read

Pulumi — Infrastructure as Code in Any Programming Language

Pulumi is infrastructure as code using general-purpose languages: TypeScript, Python, Go, C#, Java, YAML. Unlike Terraform HCL, Pulumi lets you use loops, functions, classes, and real package ecosystems to describe cloud infra.

TL;DR
Pulumi lets you define cloud infrastructure using general-purpose languages like TypeScript, Python, and Go instead of domain-specific HCL.
§01

What it is

Pulumi is an infrastructure as code (IaC) platform that lets you define and manage cloud resources using general-purpose programming languages. Unlike Terraform which uses HCL (a domain-specific language), Pulumi supports TypeScript, Python, Go, C#, Java, and YAML. This means you can use loops, conditionals, functions, classes, and existing package ecosystems to manage infrastructure.

Platform engineers, DevOps teams, and developers who prefer writing infrastructure in the same language as their application code use Pulumi as their IaC tool. It supports AWS, Azure, GCP, Kubernetes, and 100+ cloud providers.

§02

How it saves time or tokens

HCL requires learning a separate syntax with limited programming constructs. Pulumi lets you use familiar language features -- loops for creating multiple resources, functions for reusable components, type checking for catching errors before deployment, and existing package managers (npm, pip, go modules) for sharing infrastructure modules. IDE support (autocomplete, type checking, inline docs) works out of the box because you are writing in a real language.

§03

How to use

  1. Install Pulumi:
brew install pulumi  # macOS
curl -fsSL https://get.pulumi.com | sh
  1. Create a new project:
pulumi new aws-typescript  # or aws-python, azure-go, etc.
  1. Define infrastructure in code:
import * as aws from '@pulumi/aws';

const bucket = new aws.s3.Bucket('my-bucket', {
  website: { indexDocument: 'index.html' },
});

export const bucketUrl = bucket.websiteEndpoint;
  1. Deploy:
pulumi up  # preview and deploy changes
§04

Example

# Python example: create a VPC with subnets
import pulumi
import pulumi_aws as aws

vpc = aws.ec2.Vpc('main-vpc', cidr_block='10.0.0.0/16')

# Use a loop to create subnets across availability zones
azs = ['us-east-1a', 'us-east-1b', 'us-east-1c']
subnets = []
for i, az in enumerate(azs):
    subnet = aws.ec2.Subnet(f'subnet-{az}',
        vpc_id=vpc.id,
        cidr_block=f'10.0.{i}.0/24',
        availability_zone=az,
    )
    subnets.append(subnet)

pulumi.export('vpc_id', vpc.id)
pulumi.export('subnet_ids', [s.id for s in subnets])
§05

Related on TokRepo

§06

Common pitfalls

  • Pulumi state must be stored somewhere (Pulumi Cloud, S3, local file). Losing state means Pulumi cannot track existing resources. Configure a durable backend before creating production infrastructure.
  • Resource naming in Pulumi is logical, not physical. Pulumi appends random suffixes to avoid naming conflicts. Use the physical name property if you need a specific resource name.
  • Importing existing resources into Pulumi state requires the pulumi import command. Without importing, Pulumi creates duplicate resources instead of managing existing ones.

Frequently Asked Questions

How does Pulumi compare to Terraform?+

Terraform uses HCL, a domain-specific language with limited programming constructs. Pulumi uses general-purpose languages (TypeScript, Python, Go, C#, Java) with full access to loops, conditionals, functions, and package ecosystems. Both manage cloud infrastructure with state tracking and plan/apply workflows.

What cloud providers does Pulumi support?+

Pulumi supports 100+ providers including AWS, Azure, GCP, Kubernetes, DigitalOcean, Cloudflare, Datadog, and more. Each provider is available as a language-native package (npm, pip, Go module) with full type definitions and documentation.

Can I migrate from Terraform to Pulumi?+

Yes. Pulumi provides a tf2pulumi tool that converts Terraform HCL files to Pulumi programs in your chosen language. You can also import existing Terraform state into Pulumi to manage resources created by Terraform without recreating them.

Where does Pulumi store infrastructure state?+

Pulumi supports multiple state backends: Pulumi Cloud (managed, free for individuals), AWS S3, Azure Blob Storage, Google Cloud Storage, or local filesystem. The state tracks which resources Pulumi manages and their current configuration.

Does Pulumi support Kubernetes?+

Yes. Pulumi has a native Kubernetes provider that lets you define Kubernetes resources in TypeScript, Python, or Go. You can also deploy Helm charts, apply YAML manifests, and manage cluster resources alongside cloud infrastructure in the same program.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets