AI-powered security analyzer for Terraform with automated report generation.
961
A powerful, containerized tool for analyzing Terraform Plan JSON files to identify security vulnerabilities and generate actionable recommendations. Built for DevSecOps workflows, it leverages Google Gemini AI to provide intelligent insights into cloud infrastructure configurations.
docker run --rm \
-e GEMINI_API_KEY="your-api-key" \
-v "$(pwd):/app" \
wellingtoong/cloud-security-analyzer:latest \
/path/to/tfplan.json
docker run --rm \
-e GEMINI_API_KEY="your-api-key" \
-e BRANCH_NAME="feature/new-vpc" \
-e ENVIRONMENT="staging" \
-e RUN_TIMESTAMP="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
-v "$(pwd):/app" \
-v "$(pwd)/reports_output:/app/reports_output" \
wellingtoong/cloud-security-analyzer:latest \
terraform/plans/tfplan.json
The container generates two files in the reports_output/ directory:
terraform_security_report.json — Structured data for CI/CD pipelines & automationterraform_security_report.html — Interactive Tailwind CSS dashboard for stakeholdersterraform plan -out=tfplan.binary
terraform show -json tfplan.binary > tfplan.json
- name: Generate Terraform Plan
run: |
terraform init
terraform plan -out=tfplan.binary
terraform show -json tfplan.binary > plan.json
- name: Run Security Analysis
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: |
docker run --rm \
-e GEMINI_API_KEY=$GEMINI_API_KEY \
-e BRANCH_NAME=${{ github.ref_name }} \
-e ENVIRONMENT=staging \
-v "$(pwd):/app" \
wellingtoong/cloud-security-analyzer:latest \
plan.json
- name: Upload Report
uses: actions/upload-artifact@v4
with:
name: security-report
path: reports_output/
analyze_terraform:
image: wellingtoong/cloud-security-analyzer:latest
script:
- terraform init
- terraform plan -out=tfplan.binary
- terraform show -json tfplan.binary > plan.json
- python src/main.py plan.json
artifacts:
paths:
- reports_output/
expire_in: 30 days
environment:
name: staging
- task: Docker@2
inputs:
command: run
arguments: |
--rm \
-e GEMINI_API_KEY=$(GEMINI_API_KEY) \
-e BRANCH_NAME=$(Build.SourceBranchName) \
-e ENVIRONMENT=staging \
-v $(System.DefaultWorkingDirectory):/app \
wellingtoong/cloud-security-analyzer:latest \
plan.json
{
"metadata": {
"branch": "feature/new-vpc",
"timestamp": "2025-02-21T10:30:45Z",
"terraform_version": "1.6.0",
"environment": "staging"
},
"summary": {
"total_vulnerabilities": 5,
"critical": 1,
"high": 2,
"medium": 2,
"low": 0
},
"vulnerabilities": [
{
"id": "vpc-001",
"severity": "CRITICAL",
"title": "S3 Bucket Public Access",
"description": "...",
"recommendation": "..."
}
]
}
| Tag | Python | Notes |
|---|---|---|
latest | 3.12 | Recommended for production |
1.0.1 | 3.12 | Latest stable release |
1.0.0 | 3.12 | Development build |
Image Size: ~200MB (slim)
| Variable | Required | Default | Description |
|---|---|---|---|
GEMINI_API_KEY | ✅ Yes | — | Google Gemini API key |
GEMINI_MODEL | ❌ No | gemini-2.0-flash | AI model to use |
BRANCH_NAME | ❌ No | main | Git branch for metadata |
ENVIRONMENT | ❌ No | unknown | Deployment environment |
RUN_TIMESTAMP | ❌ No | Current UTC | Execution timestamp (ISO 8601) |
For comprehensive documentation, usage examples, and architecture details, visit the GitHub Repository.
MIT License — See LICENSE
Made with ❤️ for DevSecOps engineers | Star us on GitHub
Content type
Image
Digest
sha256:c55790c3a…
Size
180.4 MB
Last updated
8 months ago
docker pull wellingtoong/cloud-security-analyzer