Hacker News new | ask | show | jobs
by trallnag 1159 days ago
Maybe it shines if your infrastructure is really dynamic?
1 comments

The project I'm on involves dynamic infrastructure. I don't see any benefit Pulumi provides over Terraform in this regard. In fact, Terraform's module system is more convenient if you want to do per-tenant infra versioning for example.
You've used Pulumi extensively and don't see a single benefit?

Here's setting up Guardduty in AWS in multiple regions using a terraform module: https://github.com/gruntwork-io/terraform-aws-security/blob/...

In pulumi, it would be:

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

[ "us-east-1", "us-east-2", "us-west-1", "us-west-2", "ap-south-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "sa-east-1", ].forEach((region) => { const provider = new aws.Provider(`aws-provider-${region}`, { region: region, });

    const guardDuty = new aws.guardduty.Detector(`detector-${region}`, {
        enable: true,
    }, { provider: provider });
}); ```
The link is 404 but maybe you have a point there. I don't think this alone is enough to make me want to use Pulumi over Terraform though :)
If I use Python for my Pulumi, how could I reuse the work of a peer who uses JS for Pulumi?

Do we need to have multiple "mirrors" of our internal infra modules? Or do we need multiple language runtimes in our deployment runner in CI?

With TF, there is one language and one binary

You build a multi language component: https://www.pulumi.com/blog/pulumiup-pulumi-packages-multi-l...

You can then publish a language SDK for your supported languages, so npm for node packages, pip for python.

The invoking peer needs to have the language they're using runtime locally

The python boilerplater is here: https://github.com/pulumi/pulumi-component-provider-py-boile...

Here's an example component built in Go: https://github.com/jaxxstorm/pulumi-productionapp

Then in examples you can see it being using: https://github.com/jaxxstorm/pulumi-productionapp/tree/main/...

Thanks for that blog link! I have been asking this question for a while and you are the first to provide an actual useful answer.

Can I pass arguments to these components in other languages? Still unclear

It looks to limit, or create specific points, of where the reuse can happen. Like it is still impossible to use a helper function from one runtime in another. So we still need to maintain utilities in multiple languages

Either way, it looks like a lot more complexity for anyone who goes down this path

You would have separate JS and Python stacks that could share outputs, similar to a `terraform_remote_state` data source in terraform-land. There's also a yaml "language" support if you just want to use a config language: https://www.pulumi.com/docs/intro/languages/yaml/, but I have never messed with this, as we really just use typescript.

As somebody who maintains public terraform providers though, I do want to point out that "With TF, there is one language and one binary" is not totally accurate. Each provider you install must be installed separately, and runs separately as its own process, and the core terraform library calls out to the providers via gRPC. You can verify this by running `ps` during your next terraform run and seeing all the different providers on their own processes.

Pulumi actually uses the same gRPC setup, and can even communicate with Terraform providers. So the only real different part binary wise is the "core" terraform binary being replaced by a different "core" pulumi binary based on the language you are using, but the rest of the providers will all be the same, and you'll run multiple languages either way.

If your company only supports one or a few languages in your normal production code, you can also just use those languages for Pulumi, and still get one language and one binary. There's nothing forcing you to use multiple different languages.

It's still an extra dimension of complexity to support N language runtimes. Won't each of them still need the same TF providers?

With TF, sure there is a call to fetch those providers & modules, but still, I don't have to install N language runtimes, which needs its own IaC to build, thus adding another process to the mix

I would assume most eng orgs try to limit their Pulumi to one language to skirt this issue

> If I use Python for my Pulumi, how could I reuse the work of a peer who uses JS for Pulumi?

Standardize on the language(s). It's important. Pick 1 for Pulumi and standardize on it. Even better pick 1 or 2 for the whole company and standardize on it. In a large company...

> Or do we need multiple language runtimes in our deployment runner in CI?

Already does happen.

But back to the origin question: you can create Pulumi packages that can generate usage in different languages as required.