Amazon Connect Flow Automation with Terraform
Budget: $1,500 – $3,000 USD
The goal of this project is to build a hybrid solution where Terraform handles infrastructure provisioning and an AWS Lambda function written in Python automates the process of monitoring and updating Amazon Connect flow configurations. The Lambda function will run every 30 minutes (triggered by an EventBridge rule) to retrieve all contact flows and modules from Amazon Connect, compare them with the current versions stored in GitLab, and if discrepancies are found, automatically create a pull request with the updated code.
Key Requirements:
1. Infrastructure Setup with Terraform:
• AWS Lambda Function: Provision an AWS Lambda function using Terraform, with appropriate roles and policies to interact with both Amazon Connect and GitLab.
• Amazon EventBridge Rule: Create an EventBridge rule using Terraform to trigger the Lambda function every 30 minutes to check for updates.
• AWS Secrets Manager: Use Terraform to store credentials (e.g., GitLab API tokens) in AWS Secrets Manager or Parameter Store, ensuring secure access from the Lambda function.
• IAM Roles: Define and assign IAM roles to Lambda, ensuring that it has the least privilege access required to interact with Amazon Connect, Secrets Manager, and GitLab.
2. AWS Lambda Function (Python):
• Amazon Connect API Integration: The Lambda function will connect to Amazon Connect and download all contact flows and modules in JSON format.
• GitLab API Integration: Retrieve the stored versions of the flows from GitLab using the GitLab API, securely accessing credentials via AWS Secrets Manager.
• Comparison Logic: Implement logic to compare the downloaded JSON files from Amazon Connect with the versions in GitLab.
• Pull Request Creation: If differences are detected between the two versions, the Lambda function will:
• Update the appropriate code in the GitLab repository.
• Create and submit a pull request to GitLab for review.
• Logging and Monitoring: Implement logging for Lambda executions via CloudWatch, ensuring that each comparison and pull request process is traceable.
3. Secrets Management:
• AWS Secrets Manager: Securely store GitLab API tokens and other sensitive credentials in Secrets Manager, ensuring that the Lambda function can access these at runtime without hardcoding any sensitive information.
• Automatic Secret Rotation (optional): Implement secret rotation policies if required for enhanced security.
4. Continuous Integration/Continuous Deployment (CI/CD):
• GitLab Pipeline Integration (optional): Integrate with a GitLab CI/CD pipeline that can automatically review and merge pull requests, triggering deployment workflows if needed.
5. Modularity:
• The Terraform code should be modular, allowing for the easy addition of new Amazon Connect instances or the expansion of the solution to handle other configurations beyond contact flows.
Deliverables:
1. Terraform Scripts:
• Code to provision the Lambda function, EventBridge rule, IAM roles, and Secrets Manager entries.
2. Python Lambda Code:
• Python script to interact with the Amazon Connect API and GitLab API, compare JSON files, and create pull requests.
3. Documentation:
• Instructions on how to deploy the solution using Terraform.
• Instructions on how the Lambda function operates, and how to configure and manage secrets.
4. Testing:
• End-to-end tests verifying that the Lambda function correctly compares the flows and submits a pull request when changes are detected.
Key Requirements:
1. Infrastructure Setup with Terraform:
• AWS Lambda Function: Provision an AWS Lambda function using Terraform, with appropriate roles and policies to interact with both Amazon Connect and GitLab.
• Amazon EventBridge Rule: Create an EventBridge rule using Terraform to trigger the Lambda function every 30 minutes to check for updates.
• AWS Secrets Manager: Use Terraform to store credentials (e.g., GitLab API tokens) in AWS Secrets Manager or Parameter Store, ensuring secure access from the Lambda function.
• IAM Roles: Define and assign IAM roles to Lambda, ensuring that it has the least privilege access required to interact with Amazon Connect, Secrets Manager, and GitLab.
2. AWS Lambda Function (Python):
• Amazon Connect API Integration: The Lambda function will connect to Amazon Connect and download all contact flows and modules in JSON format.
• GitLab API Integration: Retrieve the stored versions of the flows from GitLab using the GitLab API, securely accessing credentials via AWS Secrets Manager.
• Comparison Logic: Implement logic to compare the downloaded JSON files from Amazon Connect with the versions in GitLab.
• Pull Request Creation: If differences are detected between the two versions, the Lambda function will:
• Update the appropriate code in the GitLab repository.
• Create and submit a pull request to GitLab for review.
• Logging and Monitoring: Implement logging for Lambda executions via CloudWatch, ensuring that each comparison and pull request process is traceable.
3. Secrets Management:
• AWS Secrets Manager: Securely store GitLab API tokens and other sensitive credentials in Secrets Manager, ensuring that the Lambda function can access these at runtime without hardcoding any sensitive information.
• Automatic Secret Rotation (optional): Implement secret rotation policies if required for enhanced security.
4. Continuous Integration/Continuous Deployment (CI/CD):
• GitLab Pipeline Integration (optional): Integrate with a GitLab CI/CD pipeline that can automatically review and merge pull requests, triggering deployment workflows if needed.
5. Modularity:
• The Terraform code should be modular, allowing for the easy addition of new Amazon Connect instances or the expansion of the solution to handle other configurations beyond contact flows.
Deliverables:
1. Terraform Scripts:
• Code to provision the Lambda function, EventBridge rule, IAM roles, and Secrets Manager entries.
2. Python Lambda Code:
• Python script to interact with the Amazon Connect API and GitLab API, compare JSON files, and create pull requests.
3. Documentation:
• Instructions on how to deploy the solution using Terraform.
• Instructions on how the Lambda function operates, and how to configure and manage secrets.
4. Testing:
• End-to-end tests verifying that the Lambda function correctly compares the flows and submits a pull request when changes are detected.