Getting Started
Getting started with the Kubiya provider
Getting Started with Kubiya Provider
This guide will help you get started with the Kubiya Terraform provider. By the end of this guide, you'll have created your first Kubiya AI Teammate (agent) with a basic configuration and understand how to set up more advanced integrations.
Prerequisites
- A Kubiya account with API access
- Terraform installed on your system
- Basic familiarity with Terraform
Configuring the Provider
First, you'll need to configure the Kubiya provider in your Terraform configuration. Create a new directory for your Terraform files and create a file named main.tf
with the following content:
Setting up your API Key
The Kubiya provider requires an API key for authentication. You can generate an API key from the Kubiya dashboard under Admin → Kubiya API Keys.
Set the API key as an environment variable:
Creating Your First Runner
Before you can create an agent, you need a runner. Runners are the compute environments where your agents execute code.
Add the following to your main.tf
file:
Deploying the Runner
After creating the runner resource through Terraform, you will need to deploy the helm chart of the created runner. You can use the Kubiya dashboard to access the complete helm chart for your runner.
Adding Knowledge Sources
Knowledge sources provide information to your agents. Sources are required for agent resources - every agent must have at least one source.
Creating Your First Agent (Sources Required)
Now you can create your first agent, which will use the runner and source you just defined. Remember: Every agent must have at least one source - this is a mandatory requirement:
Adding Knowledge Resources
In addition to sources, you can create specific knowledge resources that contain information your agents can reference:
Managing Sensitive Information with Secrets
Secrets allow you to securely store sensitive information that your agents might need:
Setting Up Integrations
Integrations connect your agents to external services:
Creating Webhooks for Event-Driven Automation
Webhooks allow external systems to trigger your agents:
Scheduling Recurring Tasks
Set up automated tasks that run on a schedule:
Applying Your Configuration
Initialize your Terraform configuration:
Plan your changes:
Apply your configuration:
When prompted, type yes
to confirm the changes.
Complete Basic Example
Here's a complete working example that brings together all the core resources we've discussed - runner, sources, knowledge, agent, and webhooks:
This example demonstrates:
- Creating a runner for compute
- Creating multiple sources (required for agents)
- Adding knowledge resources with content from files
- Setting up a secret for secure API access
- Configuring an agent with sources, secrets, and starters
- Adding a webhook for event-driven automation
- Setting up a scheduled task for recurring operations
It provides a complete foundation that you can customize for your specific use case.
Advanced Example 1: CI/CD Maintainer Integration
The following is a more advanced example that sets up a CI/CD Maintainer agent integrated with GitHub for workflow monitoring and failure analysis:
Next Steps
Now that you've created your first Kubiya resources with Terraform, you can:
- Enhance your agents with more integrations and knowledge sources
- Configure access control with users and groups
- Build complex automation workflows with webhooks and scheduled tasks
- Explore advanced use cases like the CI/CD Maintainer and JIT Permissions examples
Check out the resource documentation for detailed information on all the available resources and their configuration options.