Skip to content
Terraform provider for on-premise / bare-metal via Matchbox
Branch: master
Clone or download


terraform-provider-matchbox allows defining Matchbox Profiles and Groups in Terraform. Matchbox matches machines, by label (e.g. MAC address), to Profiles with iPXE configs, Container Linux configs, or generic free-form configs to provision clusters. Resources are created via the client certificate authenticated Matchbox API.


  • Terraform v0.11+ installed
  • Matchbox v0.8+ installed
  • Matchbox credentials client.crt, client.key, ca.crt


Add the terraform-provider-matchbox plugin binary for your system to the Terraform 3rd-party plugin directory ~/.terraform.d/plugins.

tar xzf terraform-provider-matchbox-$VERSION-linux-amd64.tar.gz
mv terraform-provider-matchbox-$VERSION-linux-amd64/terraform-provider-matchbox ~/.terraform.d/plugins/terraform-provider-matchbox_$VERSION

Terraform plugin binary names are versioned to allow for migrations of managed infrastructure.

$ tree ~/.terraform.d/
└── plugins
    ├── terraform-provider-matchbox_v0.2.2
    └── terraform-provider-matchbox_v0.2.3


Setup a PXE network boot environment and deploy a Matchbox instance. Be sure to enable the gRPC API and follow the instructions to generate TLS credentials.

Configure the Matchbox provider to use your Matchbox API endpoint and client certificate in a file.

provider "matchbox" {
  version = "0.2.3"
  endpoint    = ""
  client_cert = "${file("~/.matchbox/client.crt")}"
  client_key  = "${file("~/.matchbox/client.key")}"
  ca          = "${file("~/.matchbox/ca.crt")}"

Run terraform init to ensure plugin version requirements are met.

$ terraform init

Define a Matchbox Profile or Group resource in Terraform.

// Create a Container Linux install profile
resource "matchbox_profile" "container-linux-install" {
  name = "container-linux-install"
  kernel = "/assets/coreos/${var.container_linux_version}/coreos_production_pxe.vmlinuz"
  initrd = [
  args = [
  container_linux_config = "${file("./cl/coreos-install.yaml.tmpl")}"
  generic_config = "${file("./example.ks")}"

// Match a bare-metal machine
resource "matchbox_group" "node1" {
  name = "node1"
  profile = "${}"
  selector = {
    mac = "52:54:00:a1:9c:ae"
  metadata = {
    custom_variable = "machine_specific_value_here"
    ssh_authorized_key = "${var.ssh_authorized_key}"

See examples for Terraform configs which PXE boot, install CoreOS, and provision entire clusters.



To develop the provider plugin locally, build an executable with Go 1.11+.



Add or update dependencies in go.mod and vendor.

make update
make vendor
You can’t perform that action at this time.