-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from terraform/gliffy
start of gliffy
- Loading branch information
Showing
459 changed files
with
33,117 additions
and
4,680 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/" |
Oops, something went wrong.