Menu

Pulumi, Terraform or CDK?
📰

Pulumi, Terraform or CDK?

DEV Community: terraform·Desly Peter·about 16 hours ago
#DKROaIKU
#devtoterraform#devto#dev#assets#bucket
Reading 0:00
15s threshold

The same infrastructure written three ways, and what I learned.

Infrastructure as code has split into two camps. One says infrastructure should be described in a declarative configuration language, like Terraform's HCL. The other says: we already have great programming languages, why not use them? That's the idea behind Pulumi and the AWS CDK.

The best way to compare them is to write the same thing in all three. So here's a simple S3 bucket with versioning, in each.

Terraform (HCL)

resource "aws_s3_bucket" "assets" { bucket = "acme-assets-prod" tags = { environment = "production" } }

resource "aws_s3_bucket_versioning" "assets" { bucket = aws_s3_bucket . assets . id versioning_configuration { status = "Enabled" } }

output "bucket_name" { value = aws_s3_bucket . assets . bucket }

Enter fullscreen mode

Exit fullscreen mode

Pulumi (TypeScript)

import * as aws from " @pulumi/aws " ;

const assets = new aws . s3 .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.