/betterstack:migrate-terraformfrom Better Stack
Migrates Terraform configuration and state from legacy Better Stack providers (better-uptime, logtail) to the unified betterstack provider. Runs betterstack terraform migrate, merges output, and validates with terraform plan.
Ships in Better Stack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The migration changes only which provider manages each resource in Terraform state. Nothing in Better Stack changes, so a plan that adds, changes, destroys or replaces a resource is wrong and is never applied.
Follow the migration guide in references/migration-guide.md, the same guide as on the Terraform Registry, with the user: its main steps, and the section for each case below. This skill adds what an agent must do differently. Read the guide's text, not your memory of it: section names below are the guide's headings.
-auto-approve. Before an apply, show the user the plan summary and wait for their yes.terraform destroy, state rm, state mv, state push, the terraform import command, taint, or apply with -replace or -target on your own. Only the guide's "Undo the migration" and a recipe in migration.tf use one, and only when the user confirms it.removed block keeps lifecycle { destroy = false }. Without it Terraform deletes the resource.terraform show -json output hold secrets in clear text. Never print them, never paste a plan anywhere, and keep them out of the repository.terraform version is 1.8 or newer and jq is installed. If betterstack terraform migrate --help fails, ask the user to install the CLI as the guide says, and wait. The CLI reads with the token the configuration gives the old providers. Only when that token comes from somewhere else, ask the user to run betterstack signin.terraform workspace list): "Several workspaces". Each has its own state, so each gets its own backup, run and check. Instead of deleting the files between runs, run the steps of "Migrate without editing in place" up to the migration in every workspace first, each into its own new folder next to the configuration (mkdir ../migration-<workspace>, then --output ../migration-<workspace>/migration.tf), so the runs don't load each other's files. Then write one configuration, with one migration.tf in its folder, keyed by terraform.workspace as the guide shows. Remove the old providers only after every workspace is applied.umask 077; terraform plan -refresh-only -out=$HOME/refresh.tfplan, show the user what it updates, and with their yes apply that file with terraform apply $HOME/refresh.tfplan, which asks nothing.betterstack terraform migrate --plan. It edits the configuration, plans, checks the plan and stops before the apply, listing what the plan does to each resource. Show the user that list, and with their yes run betterstack terraform migrate --yes: it saves a copy of the state, applies, removes the old providers and checks the next plan. Status 1 means it stopped: do what its message says, and never work around it by editing the state. When a team name matches no team, ask the user for --team-id: never pick a team yourself. When it says your .tf files are unchanged, follow "Migrate without editing in place" with the notes below.Without editing in place:
The migration: run it as terraform show -json | betterstack terraform migrate --agent --no-rewrite, adding --output where a case below says. --agent prints every step's full recipe. Status 3 means some resources stay on the old providers, each listed at the top of migration.tf with its reason and recipe: follow the recipe when the user can, or keep the resource and the old providers for now ("The state doesn't match Better Stack" has the steps for a later run). Before step 1 declares the provider, every Terraform command fails on the new betterstack.tf. Never delete a migration.tf or betterstack.tf this session didn't write: ask the user, or name new files with --output and --config-output. First save a backup outside the repository, where only the user can read it, never over an earlier one: (umask 077; set -o noclobber; terraform state pull > ~/before-migration-$(basename "$PWD")-$(terraform workspace show).tfstate). For "Undo the migration", select that workspace first and push its own backup.
Step 2, the configuration: with resources in modules, write each module's blocks in its source and delete their commented copies from betterstack.tf. A module input the new blocks no longer use, such as a team name, becomes the input they need, such as team_id. Every value the old configuration took from a variable, a secret store or the environment, such as a header, a URL with a token or a password, goes back to that same input. A betterstack.tf that the guide has you rename or keep holds live resource blocks from then on: never delete it.
Step 3, the plan: check a saved plan instead of reading the plan output:
umask 077
rm -f $HOME/migration.tfplan $HOME/migration-plan.json
terraform init &&
terraform plan -out=$HOME/migration.tfplan &&
terraform show -json $HOME/migration.tfplan > $HOME/migration-plan.json &&
jq -e '.complete != false and .errored != true' $HOME/migration-plan.json > /dev/null &&
jq -r '(.resource_changes // [])[] | select(.change.actions != ["no-op"] and .change.actions != ["forget"] and .change.actions != ["read"]) | "\(.change.actions | join(",")) \(.address)"' $HOME/migration-plan.json
It passes only when every command succeeds and the last one prints nothing. Each address the plan forgets must be a status page section or resource, or be moved or imported to its betterstack_* address in the same plan. With several workspaces, also check that each import ID (jq -r '.resource_changes[] | select(.change.importing) | "\(.address) \(.change.importing.id)"') is the one this workspace's own run wrote: two workspaces in one team can otherwise import each other's resources. For each address it prints, read that address's block in terraform show -no-color $HOME/migration.tfplan, fix the configuration as "The plan shows changes" says, and check again. Never change the resource in Better Stack to make the plan clean.
Step 4, the apply: apply exactly the checked plan, with the user's yes: terraform apply $HOME/migration.tfplan. It must report 0 added, 0 changed, 0 destroyed.
Step 5, the second plan: it must say No changes. Delete the plan files right after the apply, also when step 5 waits for resources left on the old providers: delete $HOME/refresh.tfplan, $HOME/migration.tfplan and $HOME/migration-plan.json, and tell the user to delete the backup once they've checked their resources in Better Stack.
If a step fails partway, stop, delete the plan files, and check terraform state list before anything else.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub betterstackhq/claude-plugin --plugin betterstack17 skills in this plugin
/chart-alertsGuide for creating and managing Better Stack chart alerts. Load when asked to set up alerting, create alerts on charts, or configure monitoring thresholds./chart-generationComplete reference for chart types, units, and settings on Better Stack dashboards. Load right before creating charts - after the queries are built with the query skills./chart-stylingBetter Stack chart styling and advanced settings reference - series colors and order, number chart coloring thresholds, heatmap color categories, gauge bounds, y-axis tuning, custom units, and the per-key settings table with cross-setting gotchas. Load when configuring how a chart looks beyond defaults, or when unsure which settings key applies to a chart type.