Infrastructure
This provisions the cloud infrastructure Confident AI runs on: a private AKS cluster, a PostgreSQL Flexible Server, a Storage account with two Blob containers, and the private networking that ties them together. When it finishes you will have a running cluster and a set of outputs to feed into the Helm chart on the next page.
The azurerm provider needs the subscription set explicitly. Set it and your region once:
Create the resource group and network (optional)
Skip this if you already have a resource group and VNet with a subnet for AKS and a separate subnet delegated to Microsoft.DBforPostgreSQL/flexibleServers. Use your existing IDs in the next step.
AKS needs a subnet of its own, and PostgreSQL Flexible Server needs a separate subnet delegated to it. Run the blocks in order.
Create the resource group:
Create the VNet with the AKS subnet:
ClickHouse runs cleanly on the IPv4-only AKS cluster this module builds: the chart pins the operator’s pods to listen on IPv4 (0.0.0.0), so there is no address-family error and no dual-stack setup is required. A dual-stack VNet alone would not change this, the nodes stay IPv4-only unless the cluster itself is created dual-stack.
Add a second subnet delegated to PostgreSQL Flexible Server. It must hold nothing else:
Print the network IDs to paste into the Terraform config:
Mirror the code sandbox image (required)
Code-based and transformer metrics run in a sandboxed Azure Function, which pulls the confident-code-sandbox-azure image from an Azure Container Registry you own. Mirror the public image into your ACR. The module expects the repository name confident-code-sandbox, so tag it that way.
Create the ACR and log Docker in to it (the name must be globally unique and lowercase):
Pull the public image and push it to your ACR:
Write the Terraform config
Create a main.tf that references the published module, then fill in the IDs from the earlier steps. What each variable does:
- Resource group and network:
confident_resource_group_name,confident_azure_region, and the network IDs from the network step. - Naming:
confident_environmentandconfident_environment_codestamp theprodnaming convention onto every resource. - Access:
confident_public_aksexposes the cluster API to your machine; set itfalsefor a private-only endpoint. - Managed services:
confident_create_key_vaultandconfident_managed_redis_enabledturn on the recommended secret store and Redis, andconfident_redis_private_endpoint_subnet_idplaces Redis’s private endpoint (theakssubnet works). - Code executor:
confident_acr_login_serveris the ACR holding the image you mirrored. If the Function cannot pull from a private ACR, also setconfident_acr_admin_usernameandconfident_acr_admin_password.
Prefer to work inside the repo? Clone terraform-azurerm-confident-ai and put the same variables in a terraform.tfvars file instead of a module block.
Configure remote state (optional)
Skip this to use local state. For a team or a real environment, keep state in a Storage account.
Managed secrets and Redis (recommended)
The module block above provisions both. The Deploy page installs the External Secrets Operator, completes the one federated-credential step, and wires them into the chart:
- Key Vault + External Secrets Operator (
confident_create_key_vault = true): Terraform creates the vault and a managed identity for ESO. - Azure Managed Redis (
confident_managed_redis_enabled = true): managed Redis instead of the in-cluster one, reached over a private endpoint in the subnet you name.terraform output -raw redis_urlgives the value forredis.externalUrl.
Prefer a simpler footprint? Set both to false to hold secrets in a Kubernetes Secret and run Redis in the cluster. See Simpler option on the Deploy page.
Inputs reference
The variables you are most likely to set. For the complete, always-current list, see the module inputs on the Terraform Registry.
Required
Commonly set (optional, with production defaults)