This repository contains the Terraform code to deploy the Template Automation Lambda function and its supporting AWS resources. It is the entry point for provisioning the automation system.
This repository works together with the following:
- terraform-aws-template-automation: Provides the Terraform modules used here to deploy and manage the Lambda function and related infrastructure.
- template-automation-lambda: The Lambda function code that is deployed and managed by this repository.
This repository provisions the Lambda function, configures IAM, environment variables, and connects all components for automated repository creation.
The Lambda function is currently deployed in:
- AWS Account: csvd-dev-ew
- AWS Region: us-gov-west-1
This repository is part of the template automation system, which consists of four main repositories:
-
template-repos-lambda-deployment (This Repository)
- Contains the Terraform code that deploys the Lambda function
- Manages IAM roles, permissions, and AWS resources
- Configures environment variables for the Lambda function
-
template-automation-lambda (Lambda Function Code)
- Contains the Python code that runs in the Lambda function
- Handles GitHub API interactions through PyGithub
- Creates new repositories and configures them
-
terraform-aws-template-automation (Terraform Modules)
- Contains reusable Terraform modules for the automation system
- Used by this lambda-deployment repository
-
template-eks-cluster (Template Repository)
- Template for creating EKS clusters
- Contains the configuration files and terraform/terragrunt code
- Automated deployment of the Lambda function to AWS
- Configuration of AWS IAM roles and policies
- Management of API Gateway for Lambda invocation
- Systems Manager Parameter Store for configuration
- Environment variable configuration
- AWS credentials with appropriate permissions
- Terraform (version 1.0.0 or higher)
- AWS CLI configured with appropriate access
-
Clone this repository:
git clone <repository-url> cd template-repos-lambda-deployment
-
Update the variables in
varfiles/default.tfvars
or create a new tfvars file for your environment. -
Initialize Terraform:
terraform init
-
Plan the deployment:
terraform plan -var-file=varfiles/your-environment.tfvars -out=tf.plan
-
Apply the changes:
terraform apply tf.plan
Key variables that need to be configured include:
aws_region
: AWS region to deploy resourcesgithub_api_url
: URL of the GitHub APIgithub_org_name
: GitHub organization nametemplate_repo_name
: Name of the template repositorylambda_config
: Configuration for the Lambda function
See variables.tf
for a complete list of configuration options.
This Terraform configuration deploys:
- An AWS Lambda function
- API Gateway for invoking the Lambda
- IAM roles and policies
- Systems Manager parameters
- CloudWatch log groups
Contributions are welcome! Please feel free to submit a pull request.