Pulumi lets you write infrastructure as actual code – TypeScript, Python, C#, Go. No DSL to learn. Here’s why it’s worth considering.
Why Pulumi?
- Use your existing programming language
- Full IDE support (IntelliSense, refactoring)
- Reuse patterns with functions, classes, packages
- Test infrastructure code with regular testing frameworks
TypeScript Example
import * as azure from "@pulumi/azure-native";
// Create resource group
const resourceGroup = new azure.resources.ResourceGroup("rg");
// Create storage account
const storageAccount = new azure.storage.StorageAccount("storage", {
resourceGroupName: resourceGroup.name,
sku: { name: "Standard_LRS" },
kind: "StorageV2",
});
// Export the connection string
export const connectionString = storageAccount.primaryEndpoints.blob;
C# Example
var resourceGroup = new ResourceGroup("rg");
var storageAccount = new StorageAccount("storage", new StorageAccountArgs
{
ResourceGroupName = resourceGroup.Name,
Sku = new SkuArgs { Name = "Standard_LRS" },
Kind = "StorageV2"
});
return new Dictionary<string, object?>
{
["connectionString"] = storageAccount.PrimaryEndpoints.Apply(e => e.Blob)
};
Terraform vs Pulumi
- Terraform: Stable, huge community, HCL learning curve
- Pulumi: Real code, smaller community, native cloud providers
References
Discover more from C4: Container, Code, Cloud & Context
Subscribe to get the latest posts sent to your email.