Pulumi Any Terraform

Configuration

Configure the Buildkite provider for CI/CD pipeline management

The Buildkite provider allows you to manage CI/CD pipelines, clusters, teams, and agents in your Buildkite organization.

Provider Configuration

Required Settings

ParameterDescriptionEnvironment Variable
apiTokenBuildkite API access tokenBUILDKITE_API_TOKEN
organizationBuildkite organization slugBUILDKITE_ORGANIZATION_SLUG

Environment Variables

export BUILDKITE_API_TOKEN="bkua_your_api_token_here"
export BUILDKITE_ORGANIZATION_SLUG="your-org-slug"

Pulumi Configuration

pulumi config set buildkite:apiToken "bkua_your_api_token_here" --secret
pulumi config set buildkite:organization "your-org-slug"

Provider Instance

import * as pulumi from "@pulumi/pulumi";
import * as buildkite from "pulumi-buildkite";

const provider = new buildkite.Provider("buildkite-provider", {
    apiToken: "bkua_your_api_token_here",
    organization: "your-org-slug",
});

const pipeline = new buildkite.Pipeline("example", {
    name: "Example Pipeline",
    repository: "https://github.com/myorg/myapp.git",
    defaultBranch: "main",
    steps: `steps:\n  - command: "echo hello"`,
}, { provider });

Getting Your API Token

  1. Log in to Buildkite
  2. Go to Personal SettingsAPI Access Tokens
  3. Click New API Access Token
  4. Give it a descriptive name (e.g., "Pulumi Provider")
  5. Select the required scopes:
    • read_pipelines and write_pipelines for pipeline management
    • read_builds and write_builds for build management
    • read_agents for agent information
    • read_teams and write_teams for team management
  6. Click Create API Access Token
  7. Copy the token and store it securely

Required Scopes

OperationRequired Scopes
Manage pipelinesread_pipelines, write_pipelines
Manage teamsread_teams, write_teams
Manage agentsread_agents
Manage clustersread_clusters, write_clusters
Read organizationread_organizations
GraphQL API accessgraphql

Multi-Environment Setup

import * as pulumi from "@pulumi/pulumi";
import * as buildkite from "pulumi-buildkite";

const stack = pulumi.getStack();
const config = new pulumi.Config("buildkite");

// Use stack-specific configuration
const provider = new buildkite.Provider("buildkite", {
    apiToken: config.requireSecret("apiToken"),
    organization: config.require("organization"),
});

Best Practices

Store Tokens Securely

# Always use --secret for API tokens
pulumi config set buildkite:apiToken "bkua_..." --secret

Use Least Privilege

Create API tokens with only the scopes needed for your use case. Avoid using tokens with full access when only pipeline management is needed.

Separate Tokens per Environment

Use different API tokens for different Pulumi stacks to maintain environment isolation:

# Staging stack
pulumi stack select staging
pulumi config set buildkite:apiToken "bkua_staging_token" --secret

# Production stack
pulumi stack select production
pulumi config set buildkite:apiToken "bkua_production_token" --secret

On this page