Skip to main content

Terraform Modules

The Kubiya Control Plane Provider includes pre-built Terraform modules to help you quickly deploy common infrastructure patterns. These modules encapsulate best practices and reduce boilerplate code.

Available Modules

engineering-org Module

A comprehensive module for creating a complete engineering organization setup. This module creates and manages all necessary resources for running AI agents in your organization. Module Source: kubiya/control-plane//modules/engineering-org

engineering-org Module

Overview

The engineering-org module provides a complete infrastructure-as-code solution for setting up your AI agent organization. It creates all necessary resources including environments, projects, teams, agents, skills, policies, worker queues, and jobs.

Features

  • Flexible Configuration: Use maps to create multiple instances of each resource type
  • Sensible Defaults: Ready-to-use configuration for quick setup
  • Easy Extension: Add or modify resources by updating variable maps
  • Complete Setup: Creates all resources for a production-ready organization
  • Automatic Dependencies: Handles relationships between resources automatically
  • Resource References: Reference resources by name for easy relationship management

Resources Created

This module can create:

Usage

Minimal Example (Using Defaults)

The simplest way to use the module is with all defaults:
This creates:
  • 1 production environment
  • 1 platform project
  • 1 devops team
  • 2 agents (deployer, monitor)
  • 2 skills (shell, filesystem)
  • 1 security policy
  • 1 default worker queue
  • 1 daily health check job

Custom Configuration Example

Customize the module by providing your own variable maps:

Module Inputs

environments

Map of environments to create. Type:
Default: Creates a production environment

projects

Map of projects to create. Type:
Default: Creates a platform project

teams

Map of teams to create. Type:
Default: Creates a devops team

agents

Map of agents to create. Type:
Default: Creates deployer and monitor agents

skills

Map of skills to create. Type:
Default: Creates shell and filesystem skills

policies

Map of policies to create. Type:
Default: Creates a security policy

worker_queues

Map of worker queues to create. Type:
Default: Creates a default production queue

jobs

Map of jobs to create. Type:
Default: Creates a daily health check job

Module Outputs

Resource Collections

  • environments - Map of created environments with full details
  • projects - Map of created projects with full details
  • teams - Map of created teams with full details
  • agents - Map of created agents with full details
  • skills - Map of created skills with full details
  • policies - Map of created policies with full details
  • worker_queues - Map of created worker queues with full details
  • jobs - Map of created jobs with full details

ID Maps

  • environment_ids - Map of environment names to IDs
  • project_ids - Map of project names to IDs
  • team_ids - Map of team names to IDs
  • agent_ids - Map of agent names to IDs
  • skill_ids - Map of skill names to IDs
  • policy_ids - Map of policy names to IDs
  • worker_queue_ids - Map of worker queue names to IDs
  • job_ids - Map of job names to IDs

Special Outputs

  • job_webhook_urls - Map of webhook job names to webhook URLs (sensitive)
  • worker_queue_task_names - Map of queue names to task queue names for worker registration
  • summary - Count of all created resources

Resource Relationships

The module automatically handles dependencies between resources:

Team Assignment

Agents can reference teams using the team_name field:

Environment References

Worker queues reference environments, and jobs can reference environments:

Entity References

Jobs reference agents or teams:

Best Practices

1. Start with Defaults

Begin with the default configuration and customize incrementally:

2. Use Meaningful Resource Names

Map keys become part of resource names, so use clear, descriptive names:

3. Organize by Environment

Create separate environments for different stages:

4. Group Agents by Team

Organize agents into teams based on their function:

5. Implement Policies Early

Define governance policies from the start:

6. Create Dedicated Worker Queues

Use separate queues for different priorities:

Advanced Patterns

Multi-Environment Setup

Create a complete multi-environment infrastructure:

Module Composition

Combine multiple module instances:

Troubleshooting

Resource Already Exists

If you see “resource already exists” errors:

Dependency Errors

If you see dependency errors, verify resource names match:

JSON Encoding

Always use jsonencode() for configuration fields:

Next Steps