Setting up Pulumi (si-infrastructure)
Pulumi lets you define reusable building blocks known as "component resources." These are like your typical cloud resources but bundled with additional logic. If you are familiar with Terraform, these would be your modules.
Install
macOS (using Homebrew)
brew install pulumi
Linux
Use the install script:
curl -fsSL https://get.pulumi.com | sh
Then add Pulumi to your PATH (add this to your .bashrc or .zshrc):
export PATH="$PATH:$HOME/.pulumi/bin"
Reload your terminal:
source ~/.bashrc
# or
source ~/.zshrc
Windows
Download and install Pulumi from the official installer.
Config Passphrase
You will need the PULUMI_CONFIG_PASSPHRASE of the project to be able to use these commands.
Contact your Project Manager or Team Lead for this value.
Log into Pulumi
You will need to log-in to pulumi to make changes directly, CI/CD pipelines are able to do this to deploy updates automatically:
pulumi login s3://si-iac-state/si-pulumi/
# IAM module
pulumi login s3://si-iac-state/si-iam/
Initialize Existing Project
Navigate to your existing Pulumi project directory and initialize:
cd si-infrastructure
pulumi stack select prod
If the stack does not exist yet, create it:
pulumi stack init <your-stack-name>
Configure Your Stack
Get & Set necessary configuration values (example):
pulumi config get aws-region
pulumi config set someKey someValue --secret
Config values can then be accessed within the code as follows:
const config = new pulumi.Config("si-pulumi");
const efsList = config.getObject<string[]>("efsList");
Additional Commands
- View stack status:
pulumi stack
- View outputs:
pulumi stack output
- Tear down stack resources:
pulumi destroy
You're now set up to manage your infrastructure using Pulumi!