This repository contains an example of integration between GCP and Stigg - forward events from Pub/Sub into Stigg for usage-metering.
It's implemented using a GCP Function listens to a Pub/Sub topic, buffer messages, and sends the events to Stigg every 1 second.
- GCP account + project
- Pub/Sub topic to consume messages from
- Terraform installed
- Enable access for the required APIs on the GCP project - click here to enable them.
- Clone this repository
- Edit the EventParser.ts file to map between your event format and the Stigg format.
- Create
terraform/terraform.tfvars
file with the following content and fill in the values:gcp_project = "" pubsub_topic_id = "" stigg_api_key = ""
- Change directory
cd terraform/
- Run
terraform init
to initialize the project - Run
terraform apply -var-file=".tfvars"
to deploy the Cloud Function