Cloudrift
Pre-apply infrastructure governance for Terraform
Validate infrastructure changes against policies and live AWS state β before you apply
Cloudrift is an open-source infrastructure governance tool that validates your Terraform plans against live AWS state and security policies β catching misconfigurations before terraform apply, not after.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLOUDRIFT UNIQUE POSITION β
β β
β Terraform Plan βββ β
β ββββΆ Policy Engine βββΆ ALLOW/BLOCK β
β Live AWS State βββ (OPA) β
β β
β Competitors check EITHER plan OR live state β
β Cloudrift checks BOTH β catches drift AND policy violationsβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Table of Contents
Why Cloudrift?
| Feature |
Cloudrift |
Terraform Cloud |
Checkov |
driftctl |
| Pre-apply validation |
β
|
β |
β
|
β |
| Live state comparison |
β
|
β |
β |
β
|
| Policy engine (OPA) |
β
|
Sentinel ($$$) |
β
|
β |
| SARIF output |
β
|
β |
β
|
β |
| Open source |
β
|
β |
β
|
β
|
| Self-hosted |
β
|
β |
β
|
β
|
Key differentiator: Cloudrift compares your Terraform plan against live AWS state β catching drift that would be silently overwritten by terraform apply.
Features
- Drift Detection β Compare Terraform plans against live AWS infrastructure
- Policy Engine β 7 built-in OPA security policies + custom policy support
- Multiple Output Formats β Console, JSON, SARIF for CI/CD integration
- Multi-Service Support β S3 buckets and EC2 instances
- CI/CD Ready β GitHub Actions, GitLab CI, Jenkins integration
- GitHub Security Integration β SARIF output for Security tab
Installation
Via Go
go install github.com/inayathulla/cloudrift@latest
Via Docker
docker pull inayathulla/cloudrift
Build from Source
git clone https://github.com/inayathulla/cloudrift.git
cd cloudrift
go build -o cloudrift .
Quick Start
cd your-terraform-project
terraform init
terraform plan -out=tfplan.binary
terraform show -json tfplan.binary > plan.json
2. Create a configuration file
Create cloudrift.yml:
aws_profile: default
region: us-east-1
plan_path: ./plan.json
3. Run Cloudrift
# Scan S3 buckets
cloudrift scan --service=s3
# Scan EC2 instances
cloudrift scan --service=ec2
# Output as JSON
cloudrift scan --service=s3 --format=json
# Fail CI/CD on policy violations
cloudrift scan --service=s3 --fail-on-violation
Usage
cloudrift scan [flags]
Flags
| Flag |
Short |
Default |
Description |
--config |
-c |
cloudrift.yml |
Path to configuration file |
--service |
-s |
s3 |
AWS service to scan (s3, ec2) |
--format |
-f |
console |
Output format (console, json, sarif) |
--output |
-o |
stdout |
Write output to file |
--policy-dir |
-p |
- |
Directory with custom OPA policies |
--fail-on-violation |
- |
false |
Exit non-zero on violations |
--skip-policies |
- |
false |
Skip policy evaluation |
--no-emoji |
- |
false |
Use ASCII instead of emojis |
Supported Resources
| Resource |
Service |
Attributes Checked |
| S3 Buckets |
--service=s3 |
ACL, tags, versioning, encryption, logging, public access block, lifecycle rules |
| EC2 Instances |
--service=ec2 |
Instance type, AMI, subnet, security groups, tags, EBS optimization, monitoring |
For detailed usage instructions, see docs/USAGE.md.
Console (default)
cloudrift scan --service=s3
π Starting Cloudrift scan...
π Connected as: arn:aws:iam::123456789012:root [us-east-1]
βοΈ Evaluated 7 policies in 23ms
β οΈ Found 2 policy violations
β οΈ Drift detected!
πͺ£ my-bucket
π Encryption mismatch:
β’ expected β "AES256"
β’ actual β ""
JSON
cloudrift scan --service=s3 --format=json
{
"service": "S3",
"account_id": "123456789012",
"drift_count": 1,
"drifts": [
{
"resource_name": "my-bucket",
"diffs": {
"encryption_algorithm": ["AES256", ""]
}
}
]
}
SARIF (GitHub Security)
cloudrift scan --service=s3 --format=sarif --output=results.sarif
Upload to GitHub Code Scanning for Security tab integration.
Policy Engine
Cloudrift includes 7 built-in OPA security policies:
| Policy |
Severity |
Description |
| S3-001 |
high |
S3 buckets must have encryption enabled |
| S3-003 to S3-006 |
high |
S3 public access block settings |
| S3-007, S3-008 |
critical |
No public ACLs allowed |
| TAG-001 |
medium |
Environment tag required |
| TAG-002 to TAG-004 |
low |
Owner, Project, Name tags recommended |
Custom Policies
Create custom OPA policies:
# my-policies/custom.rego
package cloudrift.custom
deny[result] {
input.resource.type == "aws_s3_bucket"
not input.resource.planned.tags.CostCenter
result := {
"policy_id": "CUSTOM-001",
"msg": "S3 bucket must have CostCenter tag",
"severity": "medium"
}
}
cloudrift scan --service=s3 --policy-dir=./my-policies
CI/CD Integration
GitHub Actions
name: Drift Detection
on: [pull_request]
jobs:
drift-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform Plan
run: |
terraform init
terraform plan -out=tfplan.binary
terraform show -json tfplan.binary > plan.json
- name: Install Cloudrift
run: go install github.com/inayathulla/cloudrift@latest
- name: Run Drift Scan
run: cloudrift scan --service=s3 --format=sarif --output=results.sarif --fail-on-violation
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v2
if: always()
with:
sarif_file: results.sarif
GitLab CI
drift-scan:
image: golang:1.21
script:
- go install github.com/inayathulla/cloudrift@latest
- terraform init && terraform plan -out=tfplan.binary
- terraform show -json tfplan.binary > plan.json
- cloudrift scan --service=s3 --format=json --fail-on-violation
Desktop Dashboard
Cloudrift UI is a native desktop application (Flutter) that provides a visual security dashboard for Cloudrift. It invokes the CLI, parses JSON output, and displays results with real-time charts, drift diff viewers, and compliance scoring.
# Clone and run
git clone https://github.com/inayathulla/cloudrift-ui.git
cd cloudrift-ui
flutter pub get && flutter run -d macos
Features include: KPI dashboard, three-column drift diff viewer, policy browser with remediation, animated compliance ring, scan history with trend charts, and a dark cybersecurity theme.
See the Cloudrift UI README for full documentation.
Configuration
| Field |
Description |
Required |
aws_profile |
AWS credentials profile name |
Yes |
region |
AWS region to scan |
Yes |
plan_path |
Path to Terraform plan JSON |
Yes |
Example Configurations
S3 Scanning:
# config/cloudrift.yml
aws_profile: default
region: us-east-1
plan_path: ./examples/plan.json
EC2 Scanning:
# config/cloudrift-ec2.yml
aws_profile: default
region: us-east-1
plan_path: ./examples/ec2-plan.json
Project Structure
cloudrift/
βββ cmd/ # CLI commands
β βββ root.go
β βββ scan.go
βββ internal/
β βββ aws/ # AWS API integrations
β β βββ config.go # AWS SDK configuration
β β βββ s3.go # S3 API client
β β βββ ec2.go # EC2 API client
β βββ detector/ # Drift detection logic
β β βββ interface.go # Detector interface
β β βββ s3.go # S3 drift detector
β β βββ ec2.go # EC2 drift detector
β β βββ s3_printer.go # S3 console output
β β βββ ec2_printer.go # EC2 console output
β βββ output/ # Output formatters
β β βββ json.go # JSON formatter
β β βββ sarif.go # SARIF formatter
β β βββ console.go # Console formatter
β βββ policy/ # OPA policy engine
β β βββ engine.go # Policy evaluation
β β βββ loader.go # Policy loading
β β βββ policies/ # Built-in policies
β β βββ security/
β β βββ tagging/
β β βββ cost/
β βββ models/ # Data structures
β βββ parser/ # Terraform plan parser
βββ config/ # Example configurations
βββ examples/ # Example Terraform plans
βββ docs/ # Documentation
β βββ USAGE.md # Detailed usage guide
βββ tests/ # Unit tests
Roadmap
Completed β
- S3 drift detection
- EC2 drift detection
- JSON output format
- SARIF output format
- OPA policy engine
- Built-in security policies
- Custom policy support
-
--fail-on-violation flag
- Desktop dashboard (Cloudrift UI)
In Progress π§
- IAM drift detection
- Security Groups detection
- RDS drift detection
Planned π
- Compliance packs (CIS, SOC2, HIPAA)
- Multi-account scanning
- Slack/PagerDuty alerts
Contributing
Contributions are welcome!
# Clone
git clone https://github.com/inayathulla/cloudrift.git
cd cloudrift
# Build
go build -o cloudrift .
# Test
go test ./...
# Run
./cloudrift scan --service=s3 --config=config/cloudrift.yml
| Project |
Description |
| Cloudrift UI |
Native desktop security dashboard (Flutter) that visualizes Cloudrift scan results with drift diff viewers, policy browsers, compliance scoring, and trend charts. |
Connect
License
Apache License 2.0
Built for DevOps teams who believe in shift-left infrastructure governance