85 points · by kaotown · 3y ago · 53 comments
Also, Pulumi previews (equivalent to plans) are complete bullshit. If you don't write your code carefully, resources can be created and removed and you won't know it's going to happen until you start applying... it's an engineer's worst nightmare when a tool lies.
We have an equivalent of Atlantis called Pulumi Deployments[1]. The benefit of the Deployments platform is that it is entirely API driven. In addition to defining CI/CD and deployment in configuration/code, we offer APIs that let you do this programmatically. Great for platform automation where you are setting up hundreds or thousands of stacks.
In addition to `git push` workflows, we also support other deployment triggers such as a REST API. This is pretty unique, and let's you do things like build RESTful infrastructure APIs [2] ontop of the deployments platform.
- [1] https://www.pulumi.com/blog/pulumi-deployments-platform-auto... - [2] https://github.com/pulumi/deploy-demos/tree/main/deployment-...
With Terraform + Terragrunt + Atlantis, we created https://github.com/transcend-io/terragrunt-atlantis-config and had an extremely robust and easy to use flow for updating all infra code.
We've since moved to an approach where more of our infra/security things are managed in Terraform (like Guardduty, SSO, Github repo settings, etc.) maintained by more devops folks, and our app code is mostly in Pulumi (lambdas, Fargate, CloudFront/CloudFlare CDNs, etc.). To accomplish this without something like Atlantis, we moved the app code infra deployments from being deployed continuously pre-merge via Atlantis to being deployed via `pulumi up` calls in our normal CI flows, so like right next to where we build the docker images and restart ECS services, as an example.
Overall I actually really love this flow. It is so, so much easier to create multi-regional infra in Pulumi with a quick for loop, and it's also much easier to do things like run esbuild over our code in typescript, and then bundle the output of that call and send it up to a Lambda function all from pulumi/typescript without needing separate build steps or to do things like using terragrunt pre-hooks or Docker build steps inside terraform provisioners, which I always found slow and clunky.
I would agree that Pulumi's plans are a disappointment though, exactly as you said.
Overall I've been happy with the change, and we've seen some improvements I think in the velocity that developers can launch services that meet our requirements.
It's a CI/CD system specialized in Infrastructure-as-Code.
[0]: https://spacelift.io
Disclaimer: Software Engineer at Spacelift, though I'm recommending it not just because I work there, but because I think it's legitimately a very good product.
We support using the SaaS version with self-hosted workers and privately hosted VCS systems, as well as (released just last week[0]!) a fully self-hosted version of Spacelift (specifically, bring your own AWS).
[0]: https://spacelift.io/blog/introducing-spacelift-self-hosted
Our experience with Terraform is exactly the same as what you're describing with Pulumi. We have hundreds of stacks and they are all implemented differently because they are written by a hundred different people with varying knowledge of Terraform. Terraform is a goofy language and it's very hard to do even simple things like conditionals. There is also a massive amount of copy/paste because people have no idea how to set up their provider or remote states and terraform has no real way to make those DRY.
We know that we are constantly pulled in many directions in our industry, and often we take shortcuts to get the work out the door. Infra is not a place you typically want to take shortcuts. Burdening devs with the infra | ops responsibilities is a sure way to security incidents and inflated costs.
It does provide a good market for consultants|contractors to come in and clean up afterwards.
If we look at this job separation in a different analogy, why do we typically separate FE & BE development? b/c people can only be expected to be proficient in so much of the stack? And you typically want someone around who is proficient for each part of the stack?
It's just been a convenient way to divide up the work? When FE & BE don't work together and aren't aware of each other it's just another mess. And then people invented Backend For Frontend to deal with it or GraphQL. We're just adding more layers and abstractions and complexities on top.
It's valuable to have someone to be dedicated to infrastructure. It's even more valuable for everyone to be aware of the whole ecosystem. No 1 lives in a silo.
The truth is that infrastructure is not that complex when you have someone giving you building blocks and setting up guardrails. Having someone give you the pipelines and setting the boundaries is great. Choosing the pieces to get the product over the line is not that hard in a world where cloud is the norm.
We should enable everyone to at least aware of Ops and be able to contribute. Why does it need to be gated behind a special language i.e. HCL?
A lot of times things go rogue exactly because developers don't understand and claim to not have a need to understand because it's not their job. Ultimately the code runs on the infrastructure provisioned just like how we live on Earth altogether.
Just like moving to recycling and clean energy the only way is to go at it together and not create more divide.
The process of writing, reading, and understanding how the infrastructure comes to be is important. If you have never been on call for a production outage, you won't know how hard it can be to make the correct fix in a stressful situation. Being able to do that is more important than how easy it is for anyone to write the initial version. Take your time writing good IaC during development, make high-stress situations easier.
It's not gated behind a single language, there are multiple tools that provide declarative IaC. You would be surprised at how many folks in the Ops space have not written code beyond simple scripts to glue various tools together. It's something I require for our devops hires, but it is not necessary for all orgs. Most of the time you are writing TF, CF, or Yaml anyway.
It is interesting that Pulumi now supports a Yaml interface, but at that point why use that over TF directly? In the end, Pulumi is just a wrapper around TF. Personally, I use CUE -> tf.json for IaC. It's a much better wrapper with provable correctness.
I find it to be the best of both worlds
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 });
});
```targeting translation between declarative-ish languages is a natural day-1 application for LLMs
declarative languages generally good, bc 1) it's relatively easy to check them, 2) they are low-boilerplate (less to get wrong + better support for small token memories)
wonder if this backfires bc pulumi is more powerful, giving the LLM more chances to get in trouble? like there are cases where in order to check a pulumi program you would need something like TLA+ with a good model of the system you are targeting
Worth noting that while lots of insights are leveraging LLMs/AI, it's only one pillar of the launch today.
The cross cloud search and analytics are really valuable additions to the product. On day 1, being able to export all your resource definitions to BI intelligence tools and drill down into specific areas of interest is something that has traditionally been very difficult.
On a personal note, being able to simply search for "who spun up this EC2 instance" without traversing through cloudtrail is a godsend, too.
Specifically, did you solve the problem of stale API information?
What I mean is that using gpt-4 to generate code is generally very straightforward, but due to the knowledge cutoff it won't know about i.e. new AWS APIs like Lambda URLs.
Is this something you've managed to solve? Or is it just the "even with that knowledge cutoff there's enough value" situation?
We're in a good position here in that our providers have rich schemas: https://raw.githubusercontent.com/pulumi/pulumi-kubernetes/m...
However our larger providers, primarily cloud platforms, have schemas much larger than the context length of the model. So the trick is scoping that down to the necessary & sufficient amount of data into a prompt, whether via plugin (not yet available via API), preprocessing the prompt, or using a langchain-esque approach.
As Károly Zsolnai-Fehér[1] says, "what a time to be alive!"
[1] of Two Minute Papers fame: https://www.patreon.com/TwoMinutePapers
Issues:
- The majority of the documentation/examples assume you are going to be writing all your code in one big long index.js file rather than the micro stacks approach. No idea why this is considering no-one organises their code this way in any other part of a coding project so don't know why micro stack approach would not be the default approach.
- Major issues getting it to work with typescript/ts-node/tsx correctly. Could only manage to do this if I used a Pulumi Automation Runtime program rather than a Pulumi Automation Local program which was super awkward as it meant I lost access to using the CLI.
- No way of testing any serverless function that called another serverless function. Would have to use something like LocalStack if you wanted to do this (and that seemed like a nightmare) or use a npm module that didn't seem like a safe long term bet. Not entirely pulumi's fault but if you want to do this it can be done with SST or with Amazon SAM.
In the end I ended up giving up on Pulumi and will be rewriting the entire infrastructure code using SST. If I had an app that wasn't serverless I'd consider using it again but definitely wouldn't give it another shot for a serverless app until it either has similar testing functionality for serverless functions as SST or if there's an official way of interfacing with the SST framework. I'd also probably hold out until monorepo and Typescript support was better.
My frustration levels were elevated going into the month as I built the site using a new framework that went from 1.0 to 2.0 mid development and had to learn the idiosyncrasies of that. However the month from hell with Pulumi was enough to send me over the edge and I'm now taking a few weeks off from coding to get my patience back again.
Oh and I've no idea what this AI thing is like but when I tried to get ChatGPT to answer questions on Pulumi it was useless. It would flat out lie and make up classes and functions that didn't exist.
I've used ChatGPT and other tools to generate Pulumi before, so I'm not totally sure how this specific tool from Pulumi is different, but I'd guess they've somehow trained it more specifically on their sdks/docs or something
And that spec is?
Of course, the spec is the work. LLMs are then just very potent at translating it to be machine-readable.