cloud-build-slack-notifications

tfsec

Cloud Build Slack notifications

Get slack notifications whenever there’s a Cloud Build status update.

Table of contents

Pre-requisites

  1. Slack App
  2. Webhook URL for the app above

Installation

  1. Clone this repository
    git clone git@github.com:laaraujo/cloud-build-slack-notifications.git
    
  2. Change directory to the terraform folder
    cd terraform
    
  3. Install Terraform providers and dependencies
    terraform init
    

Configuration

For manual deployment

Sample terraform.tfvars:

project_id = "<gcp_project_id>"
region = "<gcp_region>"
zone = "<gcp_zone>"
slack_app_webhook_url = "<slack_app_webhook_url>"

config.yml

Config file for the slack notifier image. Let’s the actual service know where to look for the template and what kind of notifications to send

template.json

Template for the message received in Slack. This repository includes the default one but it can be customized.

resulting notifications Result notification from Cloud Build Run Sample Build option

Manual deployment

These instructions assume you already have:

  1. Check the what the terraform plan looks like:
    terraform plan
    
  2. If the output above looks good, go ahead and apply those changes (you will be prompted to confirm with “yes”):
    terraform apply
    

Sources

License

This project is licensed under the MIT License - see the LICENSE file for details.