This CDK TypeScript project creates GitHub Actions OIDC integration for secure CI/CD deployments to AWS without storing long-lived credentials.
The project sets up:
- OpenID Connect Provider for GitHub Actions
- IAM Roles with secure trust policies for repository-specific access
- CDK deployment permissions for GitHub Actions workflows
- 🔐 Secure Authentication: Uses OIDC instead of long-lived AWS credentials
- 🎯 Repository-specific Access: IAM conditions restrict access to specific GitHub repositories
- 🚀 CDK Ready: Pre-configured with CDK deployment permissions
- ✅ Well Tested: Comprehensive unit tests with fine-grained assertions
- Main Entry:
src/app.ts- defines the CDK stack and OIDC provider - Core Construct:
src/constructs/actions-oidc.ts- reusable OIDC role construct - Repository Managers:
src/oidc-manager.ts,src/startup-factory.ts- specific repository configurations
# Install dependencies
pnpm install
# Compile TypeScript
pnpm run build
# Watch for changes
pnpm run watch
# Run unit tests
pnpm test
# Run linting
pnpm lint
# Format code
pnpm run format# Deploy to AWS (requires AWS credentials)
npx cdk deploy
# Compare with deployed stack
npx cdk diff
# Generate CloudFormation template
npx cdk synthThis project includes comprehensive CDK unit tests using Jest and the AWS CDK Testing Library. Tests validate:
- OIDC provider configuration with correct GitHub thumbprints
- IAM role trust policies and permissions
- Resource creation and properties
See test/README.md for detailed testing documentation.
The OIDC provider uses GitHub's SSL certificate thumbprints for secure authentication:
- Primary:
6938fd4d98bab03faadb97b34396831e3780aea1 - Secondary:
1c58a3a8518e8759bf075b76b750d4f2df264fcd
Trust conditions restrict access to: repo:${userName}/${repoName}:*
This project uses pnpm as the primary package manager for faster, more efficient dependency management.
- Make changes to the code
- Run tests:
pnpm test - Run linting:
pnpm lint - Build the project:
pnpm run build - Deploy and test:
npx cdk deploy