Skip to content

start of gliffy #232

Merged
merged 50 commits into from
Sep 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6479a1c
start of gliffy
morga471 Mar 14, 2025
b351816
modules and makefile
morga471 Mar 14, 2025
c0d13c4
wip
morga471 Mar 14, 2025
84818d2
remove pyc files
morga471 Mar 14, 2025
b78c090
ensure assume role is partition aware
morga471 Mar 14, 2025
1f721fb
functional 0.0.1
morga471 Mar 14, 2025
ebe6a6c
expand logging, add csv output
morga471 Mar 14, 2025
17267ff
expanded help
morga471 Mar 14, 2025
9251762
version
morga471 Mar 14, 2025
db13428
interrupt handling and stats based summary
morga471 Mar 14, 2025
1144108
update output
morga471 Mar 14, 2025
42c1263
fix summary output
morga471 Mar 14, 2025
d5add6c
add eks/emr stuff
morga471 Mar 14, 2025
e64f05e
extend tag logic to all resrouces
morga471 Mar 14, 2025
4e286fb
cleaner exit
morga471 Mar 14, 2025
a94a3fc
functional
morga471 Mar 14, 2025
00693dc
add support for combined tags in eks
morga471 Mar 14, 2025
2378c33
a little cleanup
morga471 Mar 14, 2025
272c110
fix imports
morga471 Mar 14, 2025
feb44f8
working output again
morga471 Mar 18, 2025
696b7ae
added emr.py
morga471 Mar 26, 2025
d7423f3
Initial commit for testing
Mar 27, 2025
c231f15
cleanup
Mar 27, 2025
2bb101e
warmer
Mar 28, 2025
f8ee245
docs
Mar 28, 2025
987a85f
upgrade tool wip
Apr 1, 2025
ac15fd3
wip
Apr 1, 2025
48e1360
refactor for clarity
morga471 Apr 3, 2025
c79b7f8
optimized a bit
morga471 Apr 3, 2025
e498f56
cleanup
morga471 Apr 3, 2025
3fe6b1a
cleanup more
morga471 Apr 3, 2025
c488d79
cruft
morga471 Apr 3, 2025
ef7b8fd
cruft
morga471 Apr 3, 2025
a0ebd4c
fix ecr
morga471 Apr 3, 2025
ead8447
outputs csv
morga471 Apr 3, 2025
e7be1dc
fix clean-logs
morga471 Apr 3, 2025
0c9f3c9
cleanup
morga471 Apr 4, 2025
c5a5f8e
fix lints
morga471 Apr 4, 2025
9b95bc9
cruft
morga471 Apr 4, 2025
528bda1
add account alias and imagelastPulledTime
morga471 Apr 24, 2025
b8d72ce
wip
morga471 Apr 30, 2025
c26d2bf
make functional again
morga471 May 8, 2025
f3dacff
wip
morga471 Jun 4, 2025
d08275d
ecr
morga471 Jun 13, 2025
979b423
updated ecr for vulns
morga471 Jun 13, 2025
3d77b03
updated ecr for vulns
morga471 Jun 13, 2025
5b72d10
works
morga471 Jun 13, 2025
5fdf7ae
latest
morga471 Jul 10, 2025
80c437b
added more data extract from ecr
morga471 Sep 15, 2025
c184c34
add eks manager
morga471 Sep 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
AWS_PROFILE=252960665057-ma6-gov.inf-admin-t2
AWS_REGION=us-gov-east-1
# If you don't have a profile configured, you can use these instead:
# AWS_ACCESS_KEY_ID=dummy-key
# AWS_SECRET_ACCESS_KEY=dummy-secret
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
max-line-length = 88
extend-ignore = E203, W503
exclude = .git,__pycache__,build,dist,.venv
per-file-ignores =
# Allow unused imports in __init__.py files
__init__.py:F401
67 changes: 55 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,55 @@
*.log
logs/
.gitsecret/keys/random_seed
!*.secret
*.terraform
terraform.tfstate*
init/gpg-setup/tf-terraform-setup.gpg.asc
local-app/etc/.ldap-credentials
local-app/aws-account-setup/ansible/roles/setup-provider-configs/files/provider.infoblox.auto.tfvars
local-app/bin/.ldapsearch.settings
local-app/infoblox/credentials.py
local-app/infoblox/credentials.yml
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
venv/
ENV/
env/
.env/

# Testing
.coverage
htmlcov/
.pytest_cache/
.tox/
.coverage.*

# IDE files
.idea/
.vscode/
*.swp
*.swo
*~

# Terraform
.terraform/
*.tfstate
*.tfstate.backup
.terraform.lock.hcl

# Project specific
terraform_inventory.csv
provider_issues.csv
module_dependencies.png
risk_assessment*.md
upgrade_priorities.md
provider_compatibility.md
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort

- repo: https://github.com/pycqa/flake8
rev: 7.2.0
hooks:
- id: flake8
additional_dependencies: [flake8-docstrings]
# Explicitly tell flake8 to use the .flake8 config file
args: [--config=.flake8]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
207 changes: 207 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
.PHONY: help install develop clean test lint format scan dry-run upgrade verify-tools all verify-format

# Variables
DIR ?= .
TEST_FIXTURES_DIR = tests/fixtures
VERIFICATION_LOG = verification-results.log

help: ## Show this help message
@echo 'Usage: make [target] [DIR=path/to/directory]'
@echo ''
@echo 'Targets:'
@egrep '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'

all: clean setup-env develop lint format test verify-all ## Run the complete build, test, and validation workflow

install: ## Install the package
pip install .

develop: ## Install the package in development mode
pip install -e .

clean: ## Clean build artifacts
@echo "Cleaning build artifacts..."
@rm -rf build/
@rm -rf dist/
@rm -rf *.egg-info
@find . -name "__pycache__" -exec rm -rf {} +
@find . -name "*.log" -delete
@find . -name ".pytest_cache" -exec rm -rf {} +
@rm -f test-results.log
@rm -f $(VERIFICATION_LOG)
@rm -rf logs/
@rm -rf terraform-upgrade-reports/

# Test targets
test: test-setup ## Run all tests
@echo "Running all tests..."
@echo "====== TEST EXECUTION SUMMARY ======" > test-results.log
@echo "Starting unit tests at $$(date)" >> test-results.log
@python -m unittest discover -s tests/unit -p "test_*.py" -v 2>&1 | tee -a test-results.log || (echo "❌ Unit tests failed"; exit 1)
@echo "Starting integration tests at $$(date)" >> test-results.log
@python -m unittest discover -s tests/integration -p "test_*.py" -v 2>&1 | tee -a test-results.log || (echo "❌ Integration tests failed"; exit 1)
@echo "Starting validation tests at $$(date)" >> test-results.log
@python -m unittest discover -s tests/validation -p "test_*.py" -v 2>&1 | tee -a test-results.log || (echo "❌ Validation tests failed"; exit 1)
@echo "====== TEST EXECUTION COMPLETED ======" >> test-results.log
@if grep -q "FAILED" test-results.log; then \
echo "❌ Some tests failed. See test-results.log for details."; \
exit 1; \
else \
echo "✅ All tests passed successfully!"; \
fi
@echo "Detailed test results available in test-results.log"

test-setup:
@echo "Setting up test environment..."
@mkdir -p tests/output

test-unit: ## Run unit tests only
python -m unittest discover -s tests/unit -p "test_*.py" -v

test-integration: ## Run integration tests only
python -m unittest discover -s tests/integration -p "test_*.py" -v

test-validation: ## Run validation tests only
python -m unittest discover -s tests/validation -p "test_*.py" -v

# Add test directory to the Python path for test execution
export PYTHONPATH := $(PYTHONPATH):$(shell pwd)

lint: ## Run linting checks
black .
isort .
flake8 .

verify-tools: ## Verify required tools are installed
@echo "Verifying required tools..."
@python -m tf_upgrade.cli verify-env

scan: ## Scan for Terraform configurations
@python -m tf_upgrade.cli scan $(DIR)

dry-run: ## Simulate an upgrade without making changes
@python -m tf_upgrade.cli dry-run $(DIR)

upgrade: ## Upgrade Terraform configurations
@python -m tf_upgrade.cli upgrade $(DIR)

upgrade-dir: ## Upgrade a specific directory
@python -m tf_upgrade.cli upgrade $(DIR)

step: ## Interactive step-by-step upgrade
@python -m tf_upgrade.cli upgrade $(DIR) --interactive

verbose: ## Run with verbose output
@python -m tf_upgrade.cli --verbose upgrade $(DIR)

debug: ## Run with debug output
@python -m tf_upgrade.cli --debug upgrade $(DIR)

debug-scan: ## Run diagnostic scan for troubleshooting
@python tf_upgrade_diagnostics.py $(DIR) --verbose

recursive-scan: ## Run explicitly recursive scan
@python -m tf_upgrade.cli scan --recursive $(DIR)

analyze: ## Analyze complexity of Terraform configurations
@python -m tf_upgrade.cli analyze-complexity $(DIR)

assess-risk: ## Assess upgrade risk
@python -m tf_upgrade.cli assess-risk $(DIR)

generate-graph: ## Generate dependency graph
@python -m tf_upgrade.cli generate-graph $(DIR)

## Verification targets

setup-fixtures: clean-fixtures
@echo "Setting up test fixtures..."
@mkdir -p $(TEST_FIXTURES_DIR)/0.12/simple
@mkdir -p $(TEST_FIXTURES_DIR)/0.12/medium
@mkdir -p $(TEST_FIXTURES_DIR)/0.12/complex
@cp -r tests/fixtures/simple/* $(TEST_FIXTURES_DIR)/0.12/simple/
@cp -r tests/fixtures/medium/* $(TEST_FIXTURES_DIR)/0.12/medium/
@cp -r tests/fixtures/complex/* $(TEST_FIXTURES_DIR)/0.12/complex/
@echo "✅ Test fixtures created"

clean-fixtures:
@echo "Cleaning existing test fixtures..."
@rm -rf $(TEST_FIXTURES_DIR)/0.12
@rm -rf $(TEST_FIXTURES_DIR)/0.12-backup-test
@rm -rf $(TEST_FIXTURES_DIR)/0.12-upgrade-test
@rm -rf $(TEST_FIXTURES_DIR)/0.12-error-test
@rm -rf $(TEST_FIXTURES_DIR)/0.12-interactive-test

verify-env: ## Verify environment setup
@echo "Verifying environment..." | tee -a $(VERIFICATION_LOG)
@python -m tf_upgrade.cli verify-env | tee -a $(VERIFICATION_LOG)

verify-scan: ## Verify scanning functionality
@echo "Verifying scanning functionality..." | tee -a $(VERIFICATION_LOG)
@python -m tf_upgrade.cli scan $(TEST_FIXTURES_DIR)/0.12/simple | tee -a $(VERIFICATION_LOG)
@python -m tf_upgrade.cli detect-version $(TEST_FIXTURES_DIR)/0.12/simple | tee -a $(VERIFICATION_LOG)
@python -m tf_upgrade.cli analyze-complexity $(TEST_FIXTURES_DIR)/0.12/simple | tee -a $(VERIFICATION_LOG)
@echo "✅ Scan verification complete"

verify-dry-run: ## Verify dry run functionality
@echo "Verifying dry run functionality..." | tee -a $(VERIFICATION_LOG)
@python -m tf_upgrade.cli dry-run $(TEST_FIXTURES_DIR)/0.12/simple | tee -a $(VERIFICATION_LOG)
@echo "✅ Dry run verification complete"

verify-backup: ## Verify backup functionality
@echo "Verifying backup functionality..." | tee -a $(VERIFICATION_LOG)
@cp -r $(TEST_FIXTURES_DIR)/0.12/simple $(TEST_FIXTURES_DIR)/0.12/backup-test
@python -m tf_upgrade.cli upgrade $(TEST_FIXTURES_DIR)/0.12/backup-test --target-version 0.13 | tee -a $(VERIFICATION_LOG)
@if ls $(TEST_FIXTURES_DIR)/0.12/backup-test/.terraform-upgrade-backup-* > /dev/null 2>&1; then \
echo "✅ Backup created successfully"; \
else \
echo "❌ Backup creation failed"; \
exit 1; \
fi
@rm -rf $(TEST_FIXTURES_DIR)/0.12/backup-test

verify-upgrade: ## Verify upgrade functionality
@echo "Verifying upgrade functionality..." | tee -a $(VERIFICATION_LOG)
@cp -r $(TEST_FIXTURES_DIR)/0.12/simple $(TEST_FIXTURES_DIR)/0.12/upgrade-test
@python -m tf_upgrade.cli upgrade $(TEST_FIXTURES_DIR)/0.12/upgrade-test --target-version 0.13 | tee -a $(VERIFICATION_LOG)
@if grep -q 'source = "hashicorp/aws"' $(TEST_FIXTURES_DIR)/0.12/upgrade-test/*.tf; then \
echo "✅ 0.13 upgrade successful"; \
else \
echo "❌ 0.13 upgrade failed"; \
exit 1; \
fi
@rm -rf $(TEST_FIXTURES_DIR)/0.12/upgrade-test

verify-error-handling: ## Verify error handling
@echo "Verifying error handling..." | tee -a $(VERIFICATION_LOG)
@cp -r $(TEST_FIXTURES_DIR)/0.12/simple $(TEST_FIXTURES_DIR)/0.12/error-test
@echo "invalid syntax" >> $(TEST_FIXTURES_DIR)/0.12/error-test/main.tf
@python -m tf_upgrade.cli upgrade $(TEST_FIXTURES_DIR)/0.12/error-test --target-version 0.13 || echo "✅ Expected error occurred" | tee -a $(VERIFICATION_LOG)
@rm -rf $(TEST_FIXTURES_DIR)/0.12/error-test

verify-all: setup-fixtures verify-env verify-scan verify-dry-run verify-backup verify-upgrade verify-error-handling ## Run all verification tests (except interactive)
@echo "======================================================"
@echo "🎉 All verification tests completed successfully! 🎉"
@echo "Detailed results available in $(VERIFICATION_LOG)"
@echo "======================================================"

verify-format: ## Verify code formatting without making changes
black --check .
isort --check-only .
flake8 .

pytest: ## Run tests using pytest
pytest

install-dev: ## Install development dependencies
pip install -e '.[dev]'
pre-commit install

setup-env:
@echo "Setting up test environment..."
@./setup_test_env.sh

report: ## Generate comprehensive project report
@echo "Generating project report..."
@python -m tf_upgrade.reporting.generate_report
@echo "✅ Report generated in reports/"
Loading