Skip to content

Terraform Setup

Source: Onboarding RaaSv2.x — Configure Customer Terraform (TRIB 19707396243)

This page covers configuring the Terraform repository for a new RaaS customer. This is an AWS-specific process. For Azure, see Customer Onboarding — Azure Overview.

Step 1: Clone the Terraform Repo

git clone git@github.com:rhapsody-health/terraform-raas-v2.x.git
cd terraform-raas-v2.x

Step 2: Update .gitlab_ci Variables

Edit the GitLab CI configuration to add the new customer's deployment parameters:

Variable Description Example
customer_code Short customer identifier uk-hscn
regions Deployment region(s) eu-west-2
tf_backend_bucket S3 bucket for Terraform state terraform-state-943397710386
aws_account_id AWS Account ID 943397710386

Step 3: Set Customer Whitelist

Update the IP whitelist to allow access to the customer's management interfaces:

# config/{{customer_code}}/whitelist.tf (or similar)
whitelist_cidr_blocks = [
  "1.2.3.4/32",   # Customer office IP
  "5.6.7.8/32",   # GOT VPN
]

Step 4: Configure Instances

Set instance-level variables for the customer environment:

raas_instances = [
  {
    name          = "rhapsody-1"
    instance_type = "m5.xlarge"
    az            = "eu-west-2a"
    root_vol_size = 100
    data_vol_size = 500
  }
]

Step 5: Submit MR

  1. Create a branch off {{customer_code}}-dev
  2. Push and open a Merge Request targeting {{customer_code}}-dev
  3. Request review from senior engineer

Step 6: Run the Terraform Pipeline

Once the MR is merged, trigger the GitLab pipeline with:

Parameter Value
REGION Customer's AWS region (e.g. eu-west-2)
ENV prod or nonprod
MODE apply
MODULE all (for first deploy) or specific module name for targeted changes

Tip

For config-only changes that don't need infrastructure changes, use MODULE=config to reduce pipeline runtime.