A Terraform provider for managing CodeRabbit seat assignments.
- coderabbit_seats resource: Assign/unassign seats to GitHub users
- coderabbit_seats data source: Retrieve current seat assignment status
# Install dependencies
make deps
# Build and install locally
make installterraform {
required_providers {
coderabbit = {
source = "hystking/coderabbit"
version = "~> 0.1.0"
}
}
}provider "coderabbit" {
# API key can also be set via CODERABBITAI_API_KEY environment variable
api_key = "your-api-key"
# Optional: Custom API endpoint (default: https://api.coderabbit.ai)
# base_url = "https://api.coderabbit.ai"
# Optional: GitHub token for API authentication (higher rate limits)
# Can also be set via GITHUB_TOKEN environment variable
# github_token = "ghp_xxxxxxxxxxxx"
}| Variable | Description |
|---|---|
CODERABBITAI_API_KEY |
CodeRabbit API authentication key |
CODERABBIT_BASE_URL |
API base URL (optional) |
GITHUB_TOKEN |
GitHub personal access token for higher rate limits (optional) |
Specify a GitHub username to assign a seat. The provider automatically resolves the username to a numeric user ID via the GitHub API.
resource "coderabbit_seats" "developer1" {
github_id = "octocat"
}
resource "coderabbit_seats" "developer2" {
github_id = "defunkt"
}| Attribute | Type | Required | Description |
|---|---|---|---|
github_id |
string | Yes | GitHub username (e.g., "octocat") |
git_user_id |
string | - | Resolved numeric GitHub user ID (computed) |
id |
string | - | Resource ID (computed) |
data "coderabbit_seats" "all" {}
output "users_with_seats" {
value = data.coderabbit_seats.all.users_with_seats
}
output "users_without_seats" {
value = data.coderabbit_seats.all.users_without_seats
}| Attribute | Type | Description |
|---|---|---|
users_with_seats |
list(string) | List of user IDs with assigned seats |
users_without_seats |
list(string) | List of user IDs without assigned seats |
terraform {
required_providers {
coderabbit = {
source = "hystking/coderabbit"
}
}
}
provider "coderabbit" {}
# Assign seats to team members
resource "coderabbit_seats" "team" {
for_each = toset(["alice", "bob", "charlie"])
github_id = each.value
}
# Check current seat status
data "coderabbit_seats" "current" {}
output "assigned_users" {
value = data.coderabbit_seats.current.users_with_seats
}- Go 1.21+
- Terraform 1.0+
# Build
make build
# Local install
make install
# Test
make test
# Format
make fmt
# Static analysis
make vet
# Clean up
make cleanMIT License