JavaScript
From this article you can learn how to setup a Pulumi JavaScript Stack in Spacelift
Last updated
Was this helpful?
From this article you can learn how to setup a Pulumi JavaScript Stack in Spacelift
Last updated
Was this helpful?
In order to follow along with this article, you'll need an AWS account.
Start with forking the , we'll be setting up an example directory from there, namely .
Now let's open Spacelift and create a new Stack, choose the examples repo you just forked. In the second step you'll have to change multiple default values:
Set the project root to aws-js-webserver
, as we want to run Pulumi in this subdirectory only.
Add one before init script: npm install
, which will install all necessary dependencies, before initializing Pulumi itself. The outputs will be persisted in the workspace and be there for the and phases.
Set the runner image to public.ecr.aws/spacelift/runner-pulumi-javascript:latest
Pinning to a specific Pulumi version is possible too, using a tag like v2.15.4
- you can see the available versions .
In the third step, choose Pulumi as your Infrastructure as Code vendor. You'll have to choose:
A state backend, aka login URL. This can be a cloud storage bucket, like s3://pulumi-state-bucket
, but it can also be a Pulumi Service endpoint.
A stack name, which is how the state for this stack will be namespaced in the state backend. Best to write something close to your stack name, like my-javascript-pulumi-spacelift-stack
.
You can now trigger the Run manually in the Stack view, after the planning phase is over, you can check the log to see the planned changes.
Confirm the run to let it apply the changes, after applying it should look like this:
We can see the publicHostName stack output. If we try to curl it, lo and behold:
Which will destroy all created resources.
You'll now have to set up the AWS integration for the Stack, as is described in .
Go into the tab in your screen, add an AWS_REGION environment variable and set it to your region of choice, i.e. eu-central-1
.
In order to clean up, open the tab, and perform pulumi destroy --non-interactive --yes
there.