A GCP infrastructure template using Terraform for multi-environment deployments with automated CI/CD pipelines.
- Automated preview environments for feature/bugfix/hotfix branches
- Terraform workspace isolation (dev, stage, prod, preview)
- Shared GCS backend for centralized state management
- GitHub Actions workflows for automated deployment
- Semantic versioning with conventional commits
- Docker image builds and publishing to GCP Artifact Registry
- Package publishing to GCP Artifact Registry (generic and Docker)
- Manual deployment workflows with approval gates
- Branch-based infrastructure provisioning and cleanup
- bash 3.2+
- just - Command runner
- Terraform 1.5+
- gcloud CLI
- GCP project with billing enabled
# Option 1: Nedavellir CLI
nv create your-project --template nv-gcp-template
# Option 2: GitHub template + scaffold script
git clone <your-new-repo>
cd <your-new-repo>
bash scripts/scaffold.sh --project your-project# Install dependencies
just setup --dev
# Configure .envrc with your GCP project details
vim .envrc
# Allow direnv
direnv allow
# Authenticate with GCP
gcloud auth login
gcloud auth application-default login
# Create Terraform backend (one-time)
just tf-create-backendjust tf-init # Initialize Terraform
just tf-plan # Preview changes
just tf-apply # Apply changesType just to see all available commands:
❯ just
Available recipes:
[terraform]
tf-create-backend # Create GCS backend bucket
tf-init # Initialize backend and workspace
tf-plan # Preview infrastructure changes
tf-apply # Apply Terraform changes
tf-destroy # Destroy infrastructure
[docker]
docker-build # Build Docker images
docker-push # Push to GCP Artifact Registry
[ci]
publish # Publish package
deploy # Deploy applicationPush to feature/*, bugfix/*, or hotfix/* branches:
- CI runs tests, linting, formatting
- Builds Docker image tagged with issue ID
- Publishes pre-release package
- Creates isolated Terraform workspace
- Provisions preview infrastructure
- Deploys application
- Cleans up when PR is merged or branch deleted
Push to main branch:
- Analyzes conventional commits
- Bumps version and creates git tag
- Publishes package and Docker image
- Deploys to dev environment
- Creates GitHub Release
Deploy to stage/prod via GitHub Actions:
- Go to Actions → Manual Deployment
- Select version tag and environment
- Approve deployment (if required)
- User Guide - Complete setup and CI/CD workflow guide
- Architecture - System design and Terraform structure
- Infrastructure Guide - Infrastructure operations
- Development Guide - Developer workflows
Customize for your language:
# After scaffolding, customize Docker and package publishing
just setup --dev
claude /adapt # Guided customization (requires Claude CLI)Update Dockerfile and justfile build-prod recipe for your language/framework.