Link Search Menu Expand Document

The PULUMI_STACK variable

This is the story of a small open-source contribution I made to Pulumi 🎉

What we wanted

  • My team loves using direnv to select between deployment environments using directories.
    • cd deployment/clusters/dev –> magically your kubectl is configured for the dev cluster
  • We wanted to use this same approach to select which pulumi stack pulumi is pointed to
    • cd deployment/pulumi/stacks/network –> pulumi up deploys the network stack
  • Otherwise, you have to pass in your stack each time with -s (e.g. pulumi up -s network -r ...)
    • (or else it would just give you an interactive selection menu to pick each time, which gets tiring when you’re applying a lot)
  • There was also pulumi stack select which is a bit like using kubectl config set-context --current --namespace=... to avoid the -n on every command
    • But when you’re talking about infrastructure stacks, you really want it to be obvious which stack you are deploying (even though the diff stage is a bit of a failsafe)

The problem

  • Surprisingly, the --stack flag didn’t have any env variable support ❌
    • We also appeared to not be the only ones who wanted this

The solution

Impact


Click where you wanna go
mindmap root((Sean's site)) :::link:/#here-is-my-site Awesome lists 😎 :::link:/awesome-lists/ Awesome tools :::link:/awesome-lists/tools.html Useless websites :::link:/awesome-lists/useless.html Dev stories :::link:/dev-stories/ Metrics exporter :::link:/dev-stories/metrics-exporter.html Pulumi contribution :::link:/dev-stories/pulumi-contribution.html Projects :::link:/projects/ Flake utils :::link:/projects/flake-utils.html Gcloud fzf :::link:/projects/gcloud-fzf.html Job controller :::link:/projects/job-controller.html K3d :::link:/projects/k3d.html This site :::link:/projects/this-site.html Yaml resume :::link:/projects/yaml-resume.html Resume :::link:/resume.html

gimme that fun lil site map