MATIH Platform is in active MVP development. Documentation reflects current implementation status.
18. CI/CD & Build System
Tenant Modules

Tenant Modules

Tenant Terraform modules provision per-tenant cloud resources, primarily cloud AI services. These modules are invoked by the TenantService/InfrastructureService during tenant provisioning, not during the main CD pipeline.

Source: infrastructure/terraform/modules/tenant/


Module Inventory

ModulePathDescription
Cloud AI (router)tenant/cloud-ai/Routes to provider-specific module
Azure OpenAItenant/cloud-ai/azure-openai/Azure OpenAI Service deployment
AWS Bedrocktenant/cloud-ai/aws-bedrock/Amazon Bedrock model access
GCP Vertex AItenant/cloud-ai/gcp-vertex-ai/Google Vertex AI endpoint
Azure Tenanttenant/azure/Azure-specific tenant resources

Cloud AI Router Module

The router module selects the correct provider-specific module based on the tenant's cloud configuration:

# infrastructure/terraform/modules/tenant/cloud-ai/main.tf
module "azure_openai" {
  source = "./azure-openai"
  count  = var.cloud_provider == "azure" ? 1 : 0
  # ...
}
 
module "aws_bedrock" {
  source = "./aws-bedrock"
  count  = var.cloud_provider == "aws" ? 1 : 0
  # ...
}
 
module "gcp_vertex_ai" {
  source = "./gcp-vertex-ai"
  count  = var.cloud_provider == "gcp" ? 1 : 0
  # ...
}

Azure OpenAI Module

Provisions an Azure OpenAI Service resource with model deployments:

ResourcePurpose
azurerm_cognitive_accountAzure OpenAI service instance
azurerm_cognitive_deploymentModel deployment (GPT-4o, etc.)
Key Vault secretStore API key in tenant Key Vault

AWS Bedrock Module

Configures access to Amazon Bedrock foundation models:

ResourcePurpose
IAM policyGrant model invocation access
Logging configurationEnable invocation logging

GCP Vertex AI Module

Provisions Vertex AI model endpoints:

ResourcePurpose
google_vertex_ai_endpointModel serving endpoint
IAM bindingService account access

Provisioning Flow

Tenant Creation (TenantService)
    |
    v
InfrastructureService.provisionCloudAI()
    |
    v
Terraform apply (tenant/cloud-ai module)
    |
    v
Store credentials in Key Vault / Secret Manager
    |
    v
Sync to K8s Secret via ESO
    |
    v
AI Service reads secret for LLM calls

Variables

VariableTypeDescription
tenant_idstringUnique tenant identifier
cloud_providerstringazure, aws, or gcp
regionstringDeployment region
modelslistLLM models to deploy
tierstringTenant subscription tier

Related Pages