Skip to content

Conversation

@drernie
Copy link
Member

@drernie drernie commented Nov 20, 2025

Summary

Implements a comprehensive Python deployment script system for Terraform-based infrastructure deployment with externalized IAM support as specified in #91.

What's New

Deployment Script System (deploy/ directory)

Core Components:

  • tf_deploy.py - Main executable CLI script (465 lines)
  • lib/config.py - Configuration management (302 lines)
  • lib/terraform.py - Terraform orchestrator (229 lines)
  • lib/validator.py - Stack validator (388 lines)
  • lib/utils.py - Utility functions (181 lines)
  • templates/ - 4 Jinja2 templates for Terraform file generation
  • tests/ - 23 unit tests (all passing)

Key Features:

  1. Configuration-driven deployment from test/fixtures/config.json
  2. Two deployment patterns:
    • External IAM (new): Separate IAM + Application stacks
    • Inline IAM (legacy): Monolithic stack
  3. CLI commands: create, deploy, validate, destroy, status, outputs
  4. Terraform orchestration: init, validate, plan, apply, destroy
  5. Stack validation using AWS APIs
  6. Type hints throughout all modules
  7. Comprehensive logging and error handling
  8. Exit codes for automation

Usage

Installation

cd deploy
uv sync

Basic Commands

# Deploy with external IAM pattern (dry-run)
./tf_deploy.py deploy --config ../test/fixtures/config.json --pattern external-iam --dry-run

# Actual deployment
./tf_deploy.py deploy --config ../test/fixtures/config.json --pattern external-iam

# Validate deployment
./tf_deploy.py validate

# Show status
./tf_deploy.py status

# Destroy
./tf_deploy.py destroy --auto-approve

Testing

All unit tests pass:

cd deploy
pytest tests/ -v
# 23 passed in 0.05s

Documentation

  • deploy/README.md - Quick start guide
  • deploy/USAGE.md - Comprehensive usage documentation (416 lines)
  • deploy/IMPLEMENTATION_SUMMARY.md - Implementation details (434 lines)

Implementation Notes

  • Follows specification in spec/91-externalized-iam/08-tf-deploy-spec.md
  • Intelligent resource selection (VPC, subnets, certificates, Route53)
  • Handles config.json typo ("dommain" vs "domain")
  • Generates Terraform configuration dynamically
  • Validates CloudFormation stacks after deployment
  • Supports both new external-iam and legacy inline-iam patterns

Commits

This PR includes 13 new commits implementing the deployment script system:

  1. Project structure and dependencies
  2. Foundation modules (utils, init)
  3. Configuration management
  4. Terraform orchestrator
  5. Stack validator
  6. Jinja2 templates
  7. Main deployment script
  8. Unit tests (23 tests, all passing)
  9. .gitignore
  10. Usage guide (416 lines)
  11. Implementation summary (434 lines)
  12. Additional .gitignore entry

Related

  • Issue: externalized IAM #91
  • Specification: spec/91-externalized-iam/08-tf-deploy-spec.md
  • Test Guide: spec/91-externalized-iam/07-testing-guide.md

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

drernie and others added 8 commits November 20, 2025 13:28
Initial requirements analysis for externalized IAM feature following
I RASP DECO methodology. Includes:

- Problem statement and user stories
- Acceptance criteria for IAM and application modules
- Success criteria and open questions
- Coverage of 24 IAM roles and 8 managed policies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Comprehensive analysis of current Quilt infrastructure architecture for
externalized IAM implementation. Includes:

- Hybrid Terraform-CloudFormation deployment model
- IAM resources inventory (24 roles, 8 policies)
- Reference transformation patterns (GetAtt to Ref)
- Circular dependency analysis
- Existing IAM split tooling evaluation
- Architectural gaps and technical challenges
- Code idioms and conventions

Key findings:
- Monolithic 4,952-line CloudFormation template
- No IAM module currently exists
- 3 roles have circular dependencies with app resources
- Python split script demonstrates proven pattern
- Parameter count will increase from 30 to 62

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Relocate I RASP DECO documents to spec/ directory for better
organization and visibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add config.yaml as source of truth for IAM resources (24 roles, 8 policies)
- Clarify that Quilt owns, generates, and distributes templates
- Module designed specifically for Quilt's official split templates
- Add version compatibility section linking module to template versions
- Update all references from 'customer-provided' to 'Quilt-provided'
- Document release process: config.yaml → split script → templates + modules

Key architectural clarification:
- Quilt maintains templates and config.yaml
- Customers receive templates via email/download
- Module expects templates that conform to config.yaml structure
Clarify the critical misunderstanding in the original specs:
- Templates are owned, generated, and distributed by Quilt
- Customers receive templates and upload to their S3
- Module designed specifically for Quilt's official templates
- config.yaml is the source of truth for IAM resources

This document explains why the specs needed to be rewritten.
Update 04-spec-quilt-module.md and 05-spec-integration.md to clarify:
- Templates are Quilt-provided, not customer-provided
- Split script is Quilt's internal build process
- Customer responsibility: upload Quilt templates to S3, not split them
- Template preparation is Quilt internal process, not customer workflow

Completes architecture clarification started in previous commits.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add support for deploying IAM resources in separate CloudFormation stack
to enable enterprise customers with strict IAM governance requirements.

## New Features

- **IAM Module** (`modules/iam/`): New module for deploying IAM resources
  in separate CloudFormation stack with 32 outputs (24 roles + 8 policies)
- **Conditional Pattern Selection**: Quilt module now supports both inline
  IAM (default) and external IAM (opt-in via `iam_template_url`)
- **Automatic Parameter Transformation**: IAM stack outputs automatically
  transformed to application stack parameters (removes "Arn" suffix)
- **Full Backward Compatibility**: All new variables optional, existing
  deployments work unchanged

## Implementation Details

### New IAM Module (`modules/iam/`)
- `main.tf`: CloudFormation stack resource with lifecycle management
- `variables.tf`: 6 variables (2 required, 4 optional) with validation
- `outputs.tf`: 34 outputs (24 roles + 8 policies + 2 metadata)
- `README.md`: Comprehensive documentation with examples

### Enhanced Quilt Module (`modules/quilt/`)
- Added conditional IAM module instantiation (count-based)
- Added data source to query IAM stack outputs
- Added local variables for stack name and parameter transformation
- Added 4 new optional variables: `iam_template_url`, `iam_stack_name`,
  `iam_parameters`, `iam_tags`
- Added 4 new conditional outputs: `iam_stack_id`, `iam_stack_name`,
  `iam_role_arns`, `iam_policy_arns`
- Updated parameter merge logic to include IAM parameters
- Updated dependencies to ensure correct deployment order

### Documentation & Examples
- External IAM pattern example with deployment guide
- Inline IAM pattern example (default behavior)
- Implementation summary with validation checklist
- PR template with architecture diagrams and testing checklist

## Key Changes

**New Files (9)**:
- modules/iam/{main,variables,outputs}.tf + README.md
- examples/external-iam/README.md
- examples/inline-iam/README.md
- spec/91-externalized-iam/06-implementation-summary.md
- .github/PULL_REQUEST_TEMPLATE_EXTERNALIZED_IAM.md

**Modified Files (3)**:
- modules/quilt/main.tf (~60 lines added)
- modules/quilt/variables.tf (~40 lines added)
- modules/quilt/outputs.tf (~55 lines added)

## Breaking Changes

None - fully backward compatible. Inline IAM remains the default pattern.

## Migration Guide

Existing deployments: No changes required
New deployments with external IAM: Set `iam_template_url` variable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@drernie drernie linked an issue Nov 20, 2025 that may be closed by this pull request
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

18 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

drernie and others added 20 commits November 20, 2025 14:20
Add comprehensive operational documentation for externalized IAM feature:

- Overview of when to use external vs inline IAM patterns
- Step-by-step template preparation guide
- Terraform configuration examples
- Deployment procedures for external IAM
- IAM update management scenarios (policy vs resource changes)
- Migration guide from inline to external IAM
- Troubleshooting section with common issues
- Integration with daily health checks
- Change management considerations for IAM

This provides cloud operations teams with complete guidance for
deploying and maintaining Quilt with external IAM governance.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Implements and executes Test Suite 1 from spec/91-externalized-iam/07-testing-guide.md
using test fixtures in test/fixtures/.

**Test Results**: ✅ 8/8 tests passing (100%)

**What's New**:
- validate_templates.py: Python validation script with CloudFormation YAML support
- run_validation.sh: Test runner using uv for Python environment management
- TEST_RESULTS.md: Comprehensive test results and findings documentation
- README.md: Test suite overview and usage guide

**Test Coverage**:
1. ✅ IAM template YAML syntax validation
2. ✅ Application template YAML syntax validation
3. ✅ IAM template has 31 resources (23 roles + 8 policies)
4. ✅ IAM template has 31 outputs
5. ✅ Application template has 33 IAM parameters
6. ✅ Output/parameter name consistency
7. ✅ Application has minimal inline IAM (7 app-specific helpers)
8. ✅ Templates follow CloudFormation format

**Key Findings**:
- IAM template successfully externalizes 31 core Quilt IAM resources
- Application template correctly parameterizes all IAM dependencies
- 7 application-specific helper roles remain inline (acceptable)
- Templates are deployment-ready for externalized IAM pattern

**Technical Details**:
- Uses uv for Python package management
- Supports CloudFormation intrinsic functions (!Ref, !Sub, !GetAtt)
- Smart filtering for configuration vs IAM parameters
- Detailed error reporting and test summaries

**Usage**:
```bash
cd test
./run_validation.sh
```

Related to #91

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Implement complete test infrastructure based on spec/91-externalized-iam/07-testing-guide.md:

Test Scripts (all executable):
- test-01-template-validation.sh - YAML/CloudFormation validation (~5 min)
- test-02-terraform-validation.sh - Terraform module validation (~5 min)
- test-03-iam-module-integration.sh - IAM module deployment (~15 min)
- test-04-full-integration.sh - Full deployment with external IAM (~30 min)
- test-05-update-scenarios.sh - Update propagation testing (~45 min)
- test-06-comparison.sh - External vs inline IAM comparison (~60 min)
- test-07-cleanup.sh - Deletion and cleanup verification (~20 min)

Helper Scripts:
- validate-names.py - IAM output/parameter consistency validator
- get-test-url.sh - Test URL retrieval (HTTP/HTTPS support)
- setup-test-environment.sh - S3 buckets and directory setup
- run_all_tests.sh - Master test orchestrator (~3 hours total)

Documentation:
- README.md - Comprehensive test suite guide (23 KB)
  - Quick start with minimal mode (no certificate required)
  - Full mode with HTTPS and custom domains
  - Troubleshooting guide and cost estimates
- TEST_RESULTS.md - Implementation summary

Test Coverage:
- 50+ individual tests across 7 test suites
- Unit tests: Template & Terraform validation
- Integration tests: IAM & full deployment
- E2E tests: Updates & comparison testing
- Cleanup tests: Deletion verification

Key Features:
- Minimal mode testing (no ACM certificate or Route53 required)
- HTTP-only access via ALB DNS for quick validation
- Comprehensive error handling and logging
- Cost-optimized (~$0.60-0.80 for full suite)

Implementation used parallel orchestration agents to create all test
suites simultaneously, completing in ~15 minutes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
- Create deploy/ directory structure
- Add pyproject.toml with dependencies (boto3, requests, jinja2)
- Configure modern Python tooling (black, ruff, mypy)
- Add README with usage documentation

Issue: #91 (externalized IAM)
…s.py)

- Add lib/__init__.py with version info
- Implement utility functions in lib/utils.py:
  - setup_logging() for logging configuration
  - confirm_action() for user prompts
  - render_template() and render_template_file() for Jinja2 rendering
  - write_terraform_files() to generate Terraform configs
  - format_dict() and safe_get() helper functions
- Add comprehensive type hints and docstrings

Issue: #91 (externalized IAM)
- Add DeploymentConfig dataclass with all configuration fields
- Implement from_config_file() to load and parse config.json
- Add intelligent resource selection logic:
  - _select_vpc() prefers quilt-staging VPC
  - _select_subnets() finds 2+ public subnets
  - _select_security_groups() finds in-use security groups
  - _select_certificate() matches domain wildcards
  - _select_route53_zone() matches domain zones
- Implement to_terraform_vars() to generate Terraform variables
- Add default template URL generation for S3 buckets
- Support both external-iam and inline-iam patterns
- Comprehensive type hints and error handling

Issue: #91 (externalized IAM)
- Add TerraformResult dataclass for operation results
- Implement TerraformOrchestrator class with methods:
  - init() for terraform initialization with backend config
  - validate() for configuration validation
  - plan() for deployment planning
  - apply() for applying changes
  - destroy() for resource destruction
  - output() for retrieving outputs
  - get_outputs() for parsed output dictionary
- Add subprocess wrapper with timeout and error handling
- Comprehensive logging for all operations
- 1-hour timeout for long-running operations
- Type hints throughout

Issue: #91 (externalized IAM)
- Add ValidationResult dataclass for test results
- Implement StackValidator class with validation methods:
  - validate_stack() for general stack validation
  - validate_iam_stack() for IAM-specific checks
  - validate_app_stack() for application stack checks
- Implement specific validation tests:
  - _validate_stack_exists() checks stack presence
  - _validate_stack_status() checks stack state
  - _validate_resources() counts resources by type
  - _validate_iam_outputs() validates ARN format
  - _validate_iam_resources_exist() checks IAM roles
  - _validate_iam_parameters() verifies parameter injection
  - _validate_application_accessible() tests health endpoint
- Use boto3 for AWS API calls (CloudFormation, IAM, ELB)
- Comprehensive error handling and logging
- Type hints throughout

Issue: #91 (externalized IAM)
- Add backend.tf.j2 for Terraform backend and provider config
- Add variables.tf.j2 for variable definitions
- Add external-iam.tf.j2 for external IAM pattern:
  - Creates separate IAM and application stacks
  - Passes IAM outputs as parameters to app stack
  - Proper dependency ordering
- Add inline-iam.tf.j2 for inline IAM pattern:
  - Single monolithic CloudFormation stack
  - Backward compatible with existing deployments
- All templates use Jinja2 for dynamic configuration
- Include CloudFormation capabilities for IAM resources
- Add comprehensive outputs for stack tracking

Issue: #91 (externalized IAM)
- Add comprehensive CLI with argparse subcommands:
  - create: Generate Terraform configuration
  - deploy: Full deployment workflow with plan/apply
  - validate: Validate deployed stack
  - destroy: Tear down stack
  - status: Show stack status
  - outputs: Display Terraform outputs
- Implement StackDeployer class to orchestrate operations:
  - create() generates Terraform files from config
  - deploy() runs init/validate/plan/apply workflow
  - validate() checks CloudFormation stacks and resources
  - destroy() tears down infrastructure
  - status() shows deployment information
  - outputs() displays Terraform outputs
- Add comprehensive error handling with specific exit codes
- Support dry-run mode for safe planning
- Interactive confirmation prompts (overridable with --auto-approve)
- Verbose logging option for debugging
- Pattern support for both external-iam and inline-iam
- Configuration-driven from config.json
- Full type hints and docstrings
- Shebang for direct execution

Issue: #91 (externalized IAM)
- Create tests/__init__.py for test package
- Add test_config.py with tests for:
  - VPC selection logic (prefers quilt-staging)
  - Subnet selection (requires 2+ public subnets)
  - Security group selection
  - Certificate selection (wildcard matching)
  - Route53 zone selection
  - Terraform vars generation for both patterns
- Add test_utils.py with tests for:
  - Template rendering with Jinja2
  - Dictionary formatting
  - Safe nested dictionary access
- Add test_terraform.py with tests for:
  - TerraformResult dataclass
  - TerraformOrchestrator initialization
  - Output parsing and error handling
- Add pytest.ini with configuration
- All tests use pytest framework
- Tests validate error conditions and edge cases

Issue: #91 (externalized IAM)
- Ignore Python artifacts (__pycache__, *.pyc, etc.)
- Ignore virtual environments
- Ignore IDE files
- Ignore testing artifacts
- Ignore Terraform state and plan files
- Ignore deployment output directory (.deploy/)

Issue: #91 (externalized IAM)
- Document all CLI commands with examples
- Explain deployment patterns (external-iam vs inline-iam)
- Cover configuration file structure and resource selection
- Add troubleshooting section
- Include CI/CD usage examples
- Document exit codes and error handling
- Add development/testing instructions

Issue: #91 (externalized IAM)
- Document complete project structure and organization
- List all implemented modules and their functionality
- Summarize key features and capabilities
- Document testing status and coverage
- List all git commits made during implementation
- Provide file statistics (3,500+ lines of code)
- Document dependencies and requirements
- List success criteria met
- Identify known limitations
- Outline future enhancements
- Provide next steps for production deployment

Issue: #91 (externalized IAM)
drernie and others added 28 commits November 20, 2025 18:41
Update all examples to use `uv run deploy/tf_deploy.py` instead of requiring
users to cd into deploy directory and run uv sync first. This simplifies the
user experience by letting uv handle the virtual environment automatically.

Changes:
- Installation section now shows uv run as recommended approach
- All command examples updated to use uv run deploy/tf_deploy.py
- Fixed config paths from ../test/fixtures to test/fixtures (project root)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add hatchling configuration to specify lib package and update all
USAGE.md examples to use `uv run --directory deploy tf_deploy.py`.

This allows users to run the deployment script from the project root
without needing to cd into the deploy directory or run uv sync first.

Changes:
- Add tool.hatch.build.targets.wheel.packages = ["lib"] to pyproject.toml
- Update all command examples to use --directory deploy flag
- Add uv.lock for reproducible builds

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Simplify examples to use `cd deploy && uv run tf_deploy.py` approach
which avoids path confusion. Show both options clearly:
1. cd deploy && uv run (recommended, simpler paths)
2. uv run --directory deploy (from project root, requires ../ paths)

All examples now use the simpler approach with ../test/fixtures/config.json

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Change default config path from test/fixtures/config.json to
../test/fixtures/config.json so it works correctly from both:
1. Within the deploy/ directory: uv run tf_deploy.py
2. From project root: uv run --directory deploy tf_deploy.py

This eliminates the need to always specify --config for the default
test configuration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Replace deprecated `tool.uv.dev-dependencies` with the new
`dependency-groups.dev` format to eliminate deprecation warning.

This follows the updated uv specification for declaring development
dependencies.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Replace subprocess.run with subprocess.Popen to stream Terraform output
in real-time instead of buffering it until completion. This provides
better user experience by showing progress during long-running operations
like terraform init and terraform apply.

Changes:
- Use Popen with line-buffered output
- Print each line to console as it arrives
- Still capture output for error reporting
- Merge stderr into stdout for unified streaming

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fix issue where Terraform couldn't find tfvars and plan files when
paths were constructed relative to output_dir but Terraform's cwd
was already set to output_dir.

Changed to use simple relative filenames (terraform.tfvars.json,
terraform.tfplan) instead of constructing paths with output_dir,
since Terraform's working directory is already set to output_dir.

This fixes the "Failed to read variables file" error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
When applying a Terraform plan file, the -auto-approve flag causes
an error because plan files are already approved. Only use
-auto-approve when applying directly without a plan file.

Fixes: "Error: Too many command line arguments"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add support for specifying a custom S3 bucket for CloudFormation templates
in config.json. This allows users to explicitly configure which bucket
contains the template files (quilt-iam.yaml, quilt-app.yaml) instead of
using the auto-generated bucket name.

Changes:
- Add template_bucket field to DeploymentConfig dataclass
- Update URL generation methods to use custom bucket if provided
- Load template_bucket from config.json
- Document template_bucket in USAGE.md as a required field
- Add template_bucket to test/fixtures/config.json

Default behavior remains unchanged if template_bucket is not specified:
  quilt-templates-{environment}-{account_id}

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive S3 bucket validation before deployment to catch
configuration errors early, and automatically upload CloudFormation
templates to S3.

Changes:
- Add S3 bucket validation to check:
  - Bucket exists and is accessible
  - Bucket is in the correct region (prevents CloudFormation errors)
  - Template files exist and are readable
- Add automatic template upload before deployment
- Centralize template names as constants in config.py
- Add template_prefix config option to specify local template paths
- Update USAGE.md with S3 bucket configuration and troubleshooting

The validation catches errors like:
- Wrong bucket region (e.g., bucket in us-west-1 but deploying to us-east-1)
- Missing template files in S3
- Access denied to templates

This prevents waiting for Terraform/CloudFormation to fail and provides
clear error messages with solutions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…ates

The IAM CloudFormation template was failing with validation errors:
1. StackNamePrefix parameter was being passed but not defined in template
2. IAM template had invalid references to app stack resources

Fixes:
- Removed parameters block from external-iam.tf.j2 (IAM stack needs no params)
- Regenerated stable-iam.yaml and stable-app.yaml using iam-split script
- IAM template now only contains IAM resources with proper outputs
- App template references IAM resources via parameters

The IAM stack creates roles/policies and outputs their ARNs, which are
then passed to the app stack via Terraform's aws_cloudformation_stack
outputs mechanism.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Regenerated stable-iam.yaml and stable-app.yaml using updated config that
only extracts IAM resources with no dependencies on app stack resources.

IAM template now contains:
- 6 roles (ManagedUserRole, ApiRole, TimestampResourceHandlerRole, etc.)
- 3 policies (BucketReadPolicy, BucketWritePolicy, RegistryAssumeRolePolicy)
- 9 outputs (role/policy ARNs)

App template contains all other resources including IAM roles/policies that
reference buckets, queues, lambdas, and other app resources.

This eliminates circular dependency errors during CloudFormation deployment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…roles

Removed ManagedUserRole and T4BucketReadRole from extraction as they reference
AmazonECSTaskExecutionRole which must remain in the app stack.

Final IAM stack contains only 4 roles with zero dependencies:
- ApiRole
- TimestampResourceHandlerRole
- TabulatorOpenQueryRole
- S3ProxyRole

Plus 3 policies:
- BucketReadPolicy
- BucketWritePolicy
- RegistryAssumeRolePolicy

This is the minimal viable IAM split that avoids all circular dependencies.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Documents the CloudFormation template split architecture including:
- Template architecture and dependency flow
- Source template locations with relative paths
- Complete regeneration process with commands
- Detailed explanation of why only 2 roles + 3 policies can be extracted
- Dependency analysis showing circular dependencies
- Terraform integration details
- Troubleshooting guide
- Architecture decision record

This documentation ensures the template generation process is reproducible
and maintainable.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Implements spec/91-externalized-iam/09-tf-deploy-infrastructure-spec.md:

- Add parameter management methods to DeploymentConfig
  - get_required_cfn_parameters() for required CloudFormation params
  - get_optional_cfn_parameters() for optional auth params
  - get_terraform_infrastructure_config() for Terraform module config

- Update template generation to create Terraform configs
  - Generate main.tf using modules/quilt module
  - Support optional authentication (Google OAuth, Okta OAuth)
  - Create variables.tf, terraform.tfvars.json, backend.tf
  - Calculate dynamic module paths for flexible output directories

- Add comprehensive unit tests
  - 26 tests covering all new functionality
  - All tests passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add top-level Makefile to unify all testing, validation, and deployment
workflows. Replace redundant documentation with AI-optimized agent guide.

Features:
- 70+ Make targets for testing, linting, deployment
- Fast unit tests (<1 min, 38 tests, no AWS required)
- Template and Terraform validation
- Code quality checks (black, ruff, mypy, tfsec)
- Development shortcuts (t, tc, l, f, v)
- CI/CD integration (make ci)

Documentation:
- Makefile: Main automation hub (417 lines)
- AGENTS.md: AI agent guide with workflows and conventions (631 lines)
- README.md: Added Development Quick Start section
- spec/10-github-workflow-spec.md: GitHub Actions CI/CD spec

Benefits:
- Unified interface for all test types
- Fast feedback loop (make test-all <5 min)
- AI-optimized workflows for Claude Code, Copilot, Cursor
- CI/CD ready, no AWS credentials needed for most tests

Usage:
  make help        # See all commands
  make test        # Run unit tests
  make test-all    # Run all local tests
  make verify      # Verify environment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive CI/CD workflow for externalized IAM feature:
- Unit tests across Python 3.8-3.12
- Code quality checks (black, ruff, mypy)
- Coverage reporting with Codecov integration
- Parallel test execution for fast feedback
- Uses Makefile targets for consistency with local dev

Also includes terraform variable generation improvements in utils.py
to support the external-iam pattern.

Implements spec/91-externalized-iam/10-github-workflow-spec.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Format Python files to comply with black formatting rules.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove unused pytest and Path imports from test files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Tests use pytest.raises and Path, so these imports must be kept.
Only removed unused json import.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove unused 'response' variable assignment in S3 bucket validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove f-string prefixes from strings without placeholders.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Change python_version from 3.8 to 3.9 (mypy requirement)
- Add ignore_missing_imports to handle boto3/requests type stubs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add type: ignore comments for boto3 and requests imports without stubs.
Fix type annotation for result variable in safe_get function.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

externalized IAM

2 participants