Terraform module to report CodePipeline stage execution status to the GitHub commit status API using a Lambda function and CloudWatch Events.
This module supports authenticating as a GitHub App or with a GitHub personal access token. Most teams should go through the steps below to setup a GitHub App so the integration will continue to work regardless of individuals leaving.
In your GitHub organization go to Settings -> GitHub Apps (within Developer settings). Click New GitHub App.
For GitHub App name: ${your organization}-codepipeline (Must be unique.)
Description: This GitHub App updates the commit status when CodePipeline runs.
Homepage: https://github.com/rearc/terraform-aws-codepipeline-status
Uncheck Active under Webhook.
For Repository permissions add Read & write for Commit statuses.
Otherwise, leave the defaults and click Create GitHub App.
From the new application's general settings, take note of the App ID, upload a logo that will appear on all the commit statuses and generate a private key that will be used for signing access token requests.
Then go to Install App and Install in your organization. From there take note of the App installation ID which is the number at the end of the URL:
Login to the AWS Console, go to Systems Manager, go to Parameter Store and click Create parameter.
Name: codepipeline-status-key
Description: GitHub App private key for codepipeline-status-reporter Lambda function
Type: SecureString
Value: Paste the contents of the private key generated for the GitHub App.
Click Create parameter.
With the GitHub App ID, App installation ID, and the name of the parameter for the private key, you have all the input variables necessary to deploy the Terraform module to your account.