Terraform Deployment Guide

Note: If you are deploying a new operator, please refer to the DEPLOYING A NEW OPERATOR section
  1. Assign the desired operator code to environment variable OPERATOR_CODE={your_operator_code}
  2. Create a new workspace for the operator terraform workspace new $OPERATOR_CODE.
  3. Create cert folder and add the domain certificate cert.key and cert.crt inside the cert folder.
  4. Run terraform plan or fill in the values in the terraform.tfvars.copy and rename the file to terraform.tfvars.
  5. Review the changes.
  6. To start deploying, run terraform apply
  7. Get the IP address of the forwarding rules created previously gcloud compute forwarding-rules describe $OPERATOR_CODE-forwarding-rule --region asia-southeast1 | grep IPAddress.
  8. Add DNS record to Cloudflare of type A with the following name and value
  9. Name Value
    {your_operator_code} {forwarding_rule_ip}

File Naming

Pattern/Name Description
locs-**.tf Local Variables
crun-**.tf Cloud Run Services
plcs.tf GCP Policies
schs.tf Cloud Scheduler
forwarding-rule.tf Forwarding Rules
backends.tf Backend Service
neg.tf Network Endpoint Group
thp.tf Target HTTPS Proxy
ssl.tf SSL Certificate
urlmaps.tf URL Maps

Deploying a New Operator

Deploying a new operator will require the following action before using the terraform commands.

  1. Create the following Kafka topics: {operator_code}-registrations, {operator_code}-logs, {operator_code}-rounds, {operator_code}-transactions.
  2. Generate a new Firestore collection for the operator. This can be done by running the migration package in the devtools or through the WL Operator Management UI.
  3. Create and seed the Postgresql database for the operator. This can be done by running the migration package in the devtools or through the WL Operator Management UI.