1. Introduction
To share Pulumi configurations within a team, it’s recommended to store Pulumi state files in block storage. In this guide, we’ll use Cloudflare R2, which offers 100GB of free storage.
2. Setup
Prerequisites
- Create a Cloudflare account
- Create a Google Cloud account
- Purchase a domain through Cloudflare
- Install required tools using Homebrew
brew install awscli
brew install --cask google-cloud-sdk
Cloudflare R2 Configuration
- Navigate to Cloudflare R2 Object Storage
- Select ‘Create Bucket’ and name it
my-pulumi-backend
(for storing Pulumi configurations) - Check the required credentials in Manage R2 API Tokens
- Note the following information for S3-compatible API usage:
S3_ACCESS_KEY=87d2364ad95asdff4625eb9
S3_SECRET_KEY=d18743f3cc85asdf89877e6436
S3_BUCKET_NAME=my-pulumi-backend
S3_ENDPOINT=https://e17d7c715f89.r2.cloudflarestorage.com
S3_REGION=weur
- To verify with AWS CLI, configure as follows:
aws configure list
aws configure --profile r2 # Use this command to configure
AWS Access Key ID [****************5eb9]:
AWS Secret Access Key [****************6436]:
Default region name [weur]:
Default output format [json]:
- Add the following to your Pulumi .env file:
AWS_DEFAULT_PROFILE=r2
Pulumi Backend Configuration
pulumi login 's3://my-pulumi-backend?endpoint=e17d7c715f89.r2.cloudflarestorage.com'
Then add the following configuration to your pulumi.yaml file:
backend:
url: s3://my-pulumi-backend?endpoint=e17d7c715f89.r2.cloudflarestorage.com
Once this setup is complete, a .pulumi
folder will be created in your R2 bucket, where the state information will be stored.
For more details, please refer to:
https://www.pulumi.com/docs/iac/concepts/state-and-backends/