The Trunk provider lets you manage Trunk.io services with Terraform. Currently supports merge queue configuration.
terraform {
required_providers {
trunk = {
source = "trunk-io/trunk"
version = "~> 0.1"
}
}
}
provider "trunk" {
# api_key can be set here or via the TRUNK_API_KEY environment variable
}
resource "trunk_merge_queue" "example" {
repo = {
host = "github.com"
owner = "my-org"
name = "my-repo"
}
target_branch = "main"
mode = "parallel"
concurrency = 3
merge_method = "SQUASH"
}Full documentation is available on the Terraform Registry.
Set your Trunk API key via the TRUNK_API_KEY environment variable or the api_key provider attribute. Org-level API tokens are required.
go build ./...# Unit tests (no API key required)
go test ./internal/client/ -v
# Acceptance tests (requires a real API key and a test repository)
TF_ACC=1 TRUNK_API_KEY=<key> go test ./internal/provider/ -v -timeout 10mBuild the binary and configure dev_overrides to bypass the registry:
go build -o terraform-provider-trunk .Add to ~/.terraformrc:
provider_installation {
dev_overrides {
"registry.terraform.io/trunk-io/trunk" = "/path/to/terraform-provider-trunk"
}
direct {}
}Then run terraform plan in any example directory — no terraform init needed with dev_overrides.