Creates the terraform.tfvars file for the Buildkite build agent Terraform stack. Documents how to retrieve the Buildkite agent token from Buildkite UI (via Chrome DevTools MCP) and AWS SSM Parameter Store, validate tokens, and populate the tfvars file. Use when users say "create tfvars", "set up terraform variables", "deploy buildkite agents", "configure buildkite token", or need to recreate the terraform.tfvars after a fresh checkout.
76
94%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
High
Do not use without reviewing
The Terraform stack at terraform/buildkite-agents/ deploys Buildkite build
agents to AWS. It requires a terraform.tfvars file containing the Buildkite
agent registration token. This file is gitignored and must NEVER be
committed.
aws sso login --profile mockserver-build)--autoConnect (for Buildkite UI retrieval)The Buildkite agent token can be retrieved from two sources. Always retrieve from both and compare to ensure consistency.
The token is stored as a SecureString in the legacy us-east-1 region:
export DYLD_LIBRARY_PATH="/opt/homebrew/opt/expat/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
export AWS_CA_BUNDLE="${NODE_EXTRA_CA_CERTS:-}"
aws ssm get-parameter \
--name /buildkite/buildkite/agent-token \
--region us-east-1 \
--profile mockserver-build \
--with-decryption \
--query 'Parameter.Value' \
--output textThis is the authoritative source — it's the same token the legacy CloudFormation stack uses and has been validated in production.
Navigate to the Buildkite agents page and extract the token:
navigate_page(url="https://buildkite.com/organizations/mockserver/agents")take_snapshot()evaluate_script()See the browser-auth skill for detailed Chrome MCP patterns.
Compare both values:
default queue.default queue.The file lives at terraform/buildkite-agents/terraform.tfvars. Create it
from the example template:
cp terraform/buildkite-agents/terraform.tfvars.example \
terraform/buildkite-agents/terraform.tfvarsThen set buildkite_agent_token in terraform/buildkite-agents/terraform.tfvars.
CRITICAL COST REQUIREMENT: Verify min_size = 0 (MUST always be zero):
grep min_size terraform/buildkite-agents/terraform.tfvars
# Should show: min_size = 0If min_size is not 0, agents run 24/7 incurring unnecessary cost. The Lambda autoscaler handles all scaling based on queue depth — pre-created agents are never needed.
Minimal required change:
# NEVER commit this file — it is gitignored.
# Token retrieved from AWS SSM: /buildkite/buildkite/agent-token (us-east-1)
buildkite_agent_token = "<TOKEN_VALUE>"| Variable | Source of truth | Description |
|---|---|---|
buildkite_agent_token | terraform.tfvars | Buildkite agent registration token (sensitive) |
region | variables.tf / terraform.tfvars | AWS region for the agent stack |
instance_types | variables.tf / terraform.tfvars | EC2 instance types (comma-separated) |
min_size | variables.tf / terraform.tfvars | CRITICAL: MUST be 0 for scale-to-zero cost control — NEVER set to non-zero |
max_size | variables.tf / terraform.tfvars | Maximum ASG size |
on_demand_percentage | variables.tf / terraform.tfvars | Spot/On-Demand mix |
Read current defaults from terraform/buildkite-agents/variables.tf and current
overrides from terraform/buildkite-agents/terraform.tfvars.example.
After creating terraform.tfvars, deploy with:
cd terraform/buildkite-agents
./run.sh applyThe run.sh wrapper handles:
AWS_CA_BUNDLE from NODE_EXTRA_CA_CERTS)DYLD_LIBRARY_PATH)terraform init + terraform applyReview the Terraform plan and type yes to confirm.
After deployment, verify agents are working:
Check the ASG was created:
cd terraform/buildkite-agents
terraform output auto_scaling_group_nameTrigger a Buildkite build and confirm an agent picks it up
Check the Buildkite agents page for registered agents
terraform.tfvars is gitignored via terraform/**/*.tfvars in .gitignoresensitive = true in variables.tf — Terraform will
redact it from plan/apply outputterraform.tfvars817ee95
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.