Case study · Automation

DevOps Bash Script Toolkit

Ten tested Bash scripts for the jobs that come back every week: tagging releases, Terraform applies, cleanup, health checks, secrets and backups.

Source on GitHub ↗

How it fits together

  1. Script
    • set -euo pipefail
    • --help from comments
    • --dry-run
  2. Lint
    • ShellCheck
  3. Test
    • Bats tests
    • Ubuntu, macOS, Alpine, CentOS
  4. Release
    • autotag.sh
    • release workflow

The problem

Every team writes the same small scripts again, without tests, and each one fails in its own way. The goal was a set of scripts with one structure, built-in help, a dry-run mode where it matters, and tests that run on several systems.

What I built

Decisions

What went wrong: A rollback that destroys

terraform_apply_wrapper.sh has a --rollback option that runs terraform destroy when an apply fails. On a stack that already exists, that removes working resources too, not only the failed change. Safer options are to stop and keep the state, or to re-apply the last known good commit.

What I would improve next

BashShellCheckBatsGitHub ActionsTerraformKubernetesDockerAWS S3

← All projects