Terraform Provider
The ChatBotKit Terraform Provider enables you to manage your AI chatbot infrastructure using Terraform. Define bots, datasets, skillsets, integrations, and more through declarative configuration files, enabling version control, automated deployments, and infrastructure consistency across environments.
Key Features
- Infrastructure as Code: Manage ChatBotKit resources declaratively
- Full Resource Coverage: Support for bots, datasets, skillsets, integrations, and more
- Data Sources: Read existing resources for reference in configurations
- Import Support: Bring existing resources under Terraform management
- State Management: Track resource changes and drift detection
- CI/CD Integration: Automate deployments through pipelines
Installation
From Terraform Registry
Add the provider to your Terraform configuration:
Then initialize Terraform:
Requirements
- Terraform 1.0 or higher
- A ChatBotKit API key from the Dashboard
Authentication
Configure authentication using either method:
Environment Variable (Recommended for CI/CD):
Provider Configuration:
Quick Start
Here's a complete example that creates a knowledge-based support bot:
Deploy with:
Resources
The provider supports the following resources for creating and managing ChatBotKit entities:
Core Resources
| Resource | Description |
|---|---|
chatbotkit_bot | AI chatbot agents with configurable models and behaviors |
chatbotkit_dataset | Knowledge bases for retrieval-augmented generation |
chatbotkit_skillset | Collections of abilities (tools) for bots |
chatbotkit_skillset_ability | Individual abilities within a skillset |
chatbotkit_blueprint | Reusable templates for bot configurations |
chatbotkit_secret | Secure credential storage |
chatbotkit_file | File uploads for datasets and other uses |
chatbotkit_portal | Customer-facing portal configurations |
Integration Resources
| Resource | Description |
|---|---|
chatbotkit_discord_integration | Discord bot deployment |
chatbotkit_slack_integration | Slack workspace integration |
chatbotkit_telegram_integration | Telegram bot deployment |
chatbotkit_whatsapp_integration | WhatsApp Business integration |
chatbotkit_messenger_integration | Facebook Messenger integration |
chatbotkit_email_integration | Email-based interactions |
chatbotkit_twilio_integration | Twilio SMS/voice integration |
chatbotkit_widget_integration | Embeddable chat widget |
chatbotkit_notion_integration | Notion workspace sync |
chatbotkit_sitemap_integration | Website content ingestion |
chatbotkit_trigger_integration | Event-based triggers |
chatbotkit_extract_integration | Data extraction pipelines |
chatbotkit_mcpserver_integration | MCP server connections |
Data Sources
Read existing resources without managing them:
Available data sources:
chatbotkit_botchatbotkit_datasetchatbotkit_blueprintchatbotkit_skillset
Resource Examples
Bot with Full Configuration
Dataset with Records
Skillset with Multiple Abilities
Multi-Channel Deployment
Importing Existing Resources
Bring existing resources under Terraform management:
After importing, add the resource to your configuration to prevent Terraform from trying to delete it.
State Management
Remote State
For team collaboration, use remote state backends:
Workspaces
Manage multiple environments with workspaces:
CI/CD Integration
GitHub Actions Example
Best Practices
Use Variables for Reusability
Organize with Modules
terraform/
├── main.tf
├── variables.tf
├── outputs.tf
└── modules/
├── support-bot/
│ ├── main.tf
│ ├── variables.tf
│ └── outputs.tf
└── sales-bot/
└── ...
Use Lifecycle Rules
Tag Resources with Metadata
Troubleshooting
Common Issues
Authentication Errors:
Error: 401 Unauthorized
Verify your API key is set correctly via environment variable or provider configuration.
Resource Not Found:
Error: Resource not found
The resource may have been deleted outside of Terraform. Remove it from state with:
State Drift:
~ resource "chatbotkit_bot" "support" {
~ name = "Old Name" -> "New Name"
}
Someone modified the resource outside Terraform. Run terraform apply to reconcile or update your configuration to match.
Debug Logging
Enable detailed logging: