Terraform Multi-Tenant Agents (Per Customer)

Deploy a bespoke agent for each customer, each its own module/folder, composed into one shared state and deployed in a single apply. One master token plus the provider's run_as attribute targets each customer's sub-account.

terraform
infrastructure-as-code
multi-tenant
153

This example runs a multi-tenant product on ChatBotKit where every customer gets their own bespoke agent inside their own isolated sub-account - a "partner user" with its own bots, datasets, conversations, and settings.

Each customer is its own module/folder, so agents can diverge freely - one might be a support bot, another a research agent with a sandbox. A single shared root composes them all and deploys every customer in one apply, with one shared state. Isolation comes from the provider's run_as attribute: you hold one partner/master token (CHATBOTKIT_API_KEY) and each module is wired to its customer's sub-account through a provider alias whose run_as sends the X-RunAs-UserId header. No per-customer tokens, no for_each.

This is the foundation for agency and white-glove products where each customer needs a genuinely different agent that evolves independently.

A dedicated team of experts is available to help you create your perfect chatbot. Reach out via or chat for more information.