geek pro tem

Spacelift - Getting Started

Nov 23, 2022 - 2 minute read

Spacelift doesn’t have any requirements directly, but there are some items that you should have lined up before you begin using it. What I describe here isn’t strictly necessary and may not line up with your needs. For context, I use Spacelift with Github as my repository host and to login, AWS as my cloud provider, and a Mac as my workstation.

CLI

Spacelift provides a CLI utility that can be used to interface with the tool. Once you have signed up, you can login with the CLI utility and do things like list stacks, trigger runs, approve changes, etc.

AWS Access

Spacelift as a pretty nifty permission mechanism for AWS where it assumes a role with some pretty granular options in terms of which Spacelift resources will call it.

Note that this cloud integration currently doesn’t work with the free version - it will only work during the 2 week trial or if you use a paid plan. So if you start a trial, keep that in mind if this is for personal projects like mine was as the integration will stop working.

To combat that, you can generate AWS API keys and store them in a context you attach to the stacks where you need it. This is less than ideal, and is my biggest single complaint.

Either method will require you to go into your AWS account and setup a new role, or user if you don’t use the integration, and assign it permission to do things in your account. The AWS provided AdministratorAccess policy is likely what you will need.

Repository Structure

Choosing between monorepos, microrepos, etc are always contentious discussion. I chose to use a spacelift repo in my Github account to house all my modules, and then each project I wanted to manage with spacelift had a spacelift directory that contained my Spacelift configuration and Terraform code that was used for that project.

Signup for Spacelift

This is pretty easy. Go to the signup page and choose your SSO provider. If you choose Github, you’ll need to setup the application in your Github account. Make sure you have recently logged in and are prepared to get an MFA request (you do use MFA, don’t you?).

The Spacelift UI will guide you through the rest of the bootstrap tasks. There’s an option to run a demo stack, but I recommend against that just to keep things clean (it doesn’t delete easily).

That’s pretty much it. In my next article I’ll provide some sample code and instructions to build out a project.