• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Terraform provider for Matchbox on-premise / bare-metal provisioning

terraform-provider-matchbox

GoDoc Workflow Downloads Sponsors Mastodon

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, Ignition configs, or generic free-form configs to provision clusters. Resources are created via the client certificate authenticated Matchbox API.

Usage

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 with the Matchbox API endpoint and client certificate (e.g. providers.tf).

provider "matchbox" {
  endpoint    = "matchbox.example.com:8081"
  client_cert = "${file("~/.matchbox/client.crt")}"
  client_key  = "${file("~/.matchbox/client.key")}"
  ca          = "${file("~/.matchbox/ca.crt")}"
}

terraform {
  required_providers {
    matchbox = {
      source = "poseidon/matchbox"
      version = "0.5.2"
    }
  }
}

Define a Matchbox Profile or Group resource in Terraform.

// Fedora CoreOS profile
resource "matchbox_profile" "fedora-coreos-install" {
  name  = "worker"
  kernel = "https://builds.coreos.fedoraproject.org/prod/streams/${var.os_stream}/builds/${var.os_version}/x86_64/fedora-coreos-${var.os_version}-live-kernel-x86_64"

  initrd = [
    "--name main https://builds.coreos.fedoraproject.org/prod/streams/${var.os_stream}/builds/${var.os_version}/x86_64/fedora-coreos-${var.os_version}-live-initramfs.x86_64.img"
  ]

  args = [
    "initrd=main",
    "coreos.live.rootfs_url=https://builds.coreos.fedoraproject.org/prod/streams/${var.os_stream}/builds/${var.os_version}/x86_64/fedora-coreos-${var.os_version}-live-rootfs.x86_64.img",
    "coreos.inst.install_dev=/dev/sda",
    "coreos.inst.ignition_url=${var.matchbox_http_endpoint}/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}"
  ]

  raw_ignition = data.ct_config.worker.rendered
}

data "ct_config" "worker" {
  content = templatefile("fcc/fedora-coreos.yaml", {
    ssh_authorized_key = var.ssh_authorized_key
  })
  strict = true
}

// Default matcher group for machines
resource "matchbox_group" "default" {
  name    = "default"
  profile = matchbox_profile.fedora-coreos-install.name
  selector = {}
  metadata = {}
}

Run terraform init to ensure plugin version requirements are met.

$ terraform init

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

Requirements

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

Development

Binary

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

make

More Repositories

1

typhoon

Minimal and free Kubernetes distribution with Terraform
HCL
1,859
star
2

matchbox

Network boot and provision Fedora CoreOS and Flatcar Linux clusters
Go
1,177
star
3

terraform-provider-ct

Terraform provider for converting Butane Configs to Ignition
Go
177
star
4

terraform-render-bootstrap

Low-level bootstrap a Kubernetes control plane with Terraform (part of Typhoon)
HCL
101
star
5

fleetlock

Reboot coordinator for Fedora CoreOS nodes using the Zincati FleetLock protocol
Go
69
star
6

terraform-digitalocean-kubernetes

Typhoon DigitalOcean - minimal and free Kubernetes (mirror)
HCL
33
star
7

terraform-aws-kubernetes

Typhoon AWS - minimal and free Kubernetes (mirror)
HCL
31
star
8

terraform-onprem-kubernetes

Typhoon bare-metal - minimal and free Kubernetes (mirror)
HCL
31
star
9

terraform-google-kubernetes

Typhoon Google Cloud - minimal and free Kubernetes (mirror)
HCL
25
star
10

dnsmasq

Network infrastructure for small networks
Makefile
20
star
11

scuttle

Kubelet graceful node drain/delete and spot termination watcher
Go
16
star
12

kubelet

Upstream Kubelet packaged as a container image
Makefile
15
star
13

wait-for-status-checks

GitHub Action that waits for check runs
TypeScript
9
star
14

terraform-provider-cue

Terraform provider for evaluting CUE to render JSON
Go
8
star
15

terraform-provider-util

Terraform provider for special utilities
Go
3
star
16

flannel-cni

Flannel init container to install a CNI config and CNI plugins
Shell
2
star
17

blog-bits

Code from the Poseidon Labs blog
Shell
1
star
18

terraform-azure-kubernetes

Typhoon Azure - minimal and free Kubernetes (mirror)
HCL
1
star
19

system-containers

System container images for Typhoon for Fedora Atomic
Makefile
1
star
20

github-runner

GitHub Actions self-hosted runner container image that registers itself
Go
1
star