- Terraform CLI
brew install terraform - Azure CLI
brew install azure-cli - Helm
brew install helm - Azure account in Cleanlab's tenant
- ask Kelsey if you need to be invited
- Minimum required Azure role assignments:
Readeron the OpenAI service resource grouptlm-staging-rgStorage Blob Data Readeron thetlmtfstatestorage account
Below are optional Azure roles to request on the Production subscription. Ask Kelsey if you want permissions.
Readerfor global read accessAzure Kubernetes Service Contributorfor access to live/historical container logs,kubectlusage, and more
Import the existing resources to Terraform:
cd deploy/terraform/azure/app
cp staging.tfvars.example staging.tfvars
terraform import -var-file="staging.tfvars" 'module.app.azurerm_role_assignment.openai_identity_sa' "/subscriptions/a47bf188-5236-4db5-bde5-16655f9d07ec/resourceGroups/tlm-staging-rg/providers/Microsoft.CognitiveServices/accounts/tlm-openai/providers/Microsoft.Authorization/roleAssignments/5c088622-3f50-84c7-e52e-09d253ed0325"
terraform import -var-file="staging.tfvars" 'module.app.helm_release.this' tlm/tlm
Follow these instructions to deploy TLM app changes through CLI. Note that after merging to main, you must wait for the Release TLM App / build-push-chat-backend-acr step to finish before starting the deployment process.
-
Run
az loginand select theProductionsubscription -
Change your working directory:
cd deploy/terraform/azure/app -
Set up your Terraform variables:
- If this is your first time deploying,
cp staging.tfvars.example staging.tfvars - Modify the
.tfvarsfile by settingapp_image_tagto the Git commit SHA that you want to deploy
- If this is your first time deploying,
-
terraform init -
terraform plan -var-file="staging.tfvars" -out=tfplan.planThe plan should be
0 to add, 1 to change, 0 to destroy. It will only include modifying the Helm release resourcemodule.app.helm_release.thisto update thechat_backend.image.tag, plus modifying some metadata. If anything else is included in the plan, check that your branch has the latest version of the Terraform script, or reach out in #azure. -
If the plan looks good, apply the changes by running
terraform apply tfplan.plan.Note that this will NOT prompt you to confirm the changes because they were already saved by the planning step, so be careful!
If you encounter permission issues (4xx status codes) when running any of the terraform commands, try unsetting the ARM_* environment variables. These can interfere with Azure-related authentication when managing resources.
unset ARM_CLIENT_ID ARM_CLIENT_SECRET ARM_TENANT_ID ARM_SUBSCRIPTION_ID