Modern Terraform infrastructure deployment pipeline using Buildkite, Clivern Lynx state backend, and comprehensive security scanning.
- Overview
- Features
- Architecture
- Prerequisites
- Quick Start
- Project Structure
- Pipeline Stages
- Configuration
- Security
- Deployment
- Troubleshooting
- Contributing
- License
This repository contains Terraform infrastructure-as-code that deploys and manages cloud resources using a modern CI/CD pipeline with:
- ποΈ Infrastructure as Code: OpenTofu/Terraform for declarative infrastructure
- π CI/CD Automation: Buildkite for pipeline orchestration
- πΎ State Management: Clivern Lynx HTTP backend with distributed locking
- π Security: Comprehensive scanning with TFSec, Checkov, Terrascan, KICS
- π‘οΈ Compliance: Mondoo security posture management
- π Secrets: HashiCorp Vault for secure credential management
- π€ AI Analysis: Fabric AI and Overmind for plan analysis
- β Multi-environment support (dev, staging, production)
- β Progressive deployment with approval gates
- β Automated state backups before changes
- β Rollback capabilities
- β Environment-specific configurations
- β TFSec - Terraform static analysis
- β Checkov - Policy-as-code scanning
- β Terrascan - Infrastructure security scanner
- β KICS - Comprehensive IaC scanner
- β GitGuardian - Secret detection
- β Mondoo - Security posture management
- β Compliance score enforcement (minimum 85%)
- β Fabric AI - Natural language plan analysis
- β Overmind - Blast radius calculation
- β Change impact assessment
- β Risk scoring and recommendations
- β Module-based architecture
- β Reusable Terraform modules
- β Version-pinned dependencies
- β Automated documentation generation
- β Drift detection
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Buildkite CI/CD β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Validation ββ β Security ββ β Deployment β β
β β & Formatting β β Scanning β β Pipeline β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
ββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
βββββββββββββ΄ββββββββββββ
βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ
β HashiCorp β β Clivern Lynx β
β Vault β β State Backend β
β (Secrets) β β (HTTP + Lock) β
βββββββββββββββββββ βββββββββββββββββββ
β β
βββββββββββββ¬ββββββββββββ
βΌ
βββββββββββββββββββ
β Cloud β
β Infrastructureβ
β (AWS/Azure) β
βββββββββββββββββββ
| Tool | Minimum Version | Purpose |
|---|---|---|
| OpenTofu | 1.6.0+ | Infrastructure provisioning |
| PowerShell | 7.0+ | Script execution |
| Buildkite Agent | 3.x+ | CI/CD pipeline execution |
| Vault CLI | 1.15.0+ | Secret management |
| Tool | Purpose |
|---|---|
| Fabric AI | AI-powered plan analysis |
| Overmind CLI | Blast radius analysis |
| terraform-docs | Documentation generation |
- β HashiCorp Vault access with JWT authentication
- β Clivern Lynx HTTP backend endpoint
- β Buildkite organization and pipeline
- β Cloud provider credentials (AWS/Azure/GCP)
- β Mondoo service account token
git clone https://github.com/yourorg/terraform-infrastructure.git
cd terraform-infrastructureEdit .buildkite/pipeline.yml:
env:
PROJECT_NAME: "my-infrastructure"
SERVICE_NAME: "my-service"
TARGET_ENVIRONMENTS: "dev,stg,prd"
VAULT_NAMESPACE: "DevOps/prd/my-project"
LYNX_BASE_URL: "https://lynx.company.com"# Lynx backend credentials
vault kv put secret/lynx/terraform \
username="terraform-user" \
password="secure-password"
# Mondoo token
vault kv put secret/mondoo \
token="your-mondoo-token"mkdir -p dev stg prd
cd dev
cat > main.tf <<EOF
terraform {
required_version = ">= 1.6.0"
backend "http" {
# Configured by Initialize-TofuBackend
}
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 5.0"
name = "my-vpc"
cidr = "10.0.0.0/16"
}
EOFgit add .
git commit -m "feat: initial infrastructure setup"
git push origin mainVisit your Buildkite dashboard to see the pipeline run! π