/terraform-raspberrypi-bootstrap

Terraform Provisioner for bootstrapping a Raspberry Pi (Stretch) base configuration.

Primary LanguageHCLMIT LicenseMIT

terraform-raspberrypi-bootstrap

NOTE: Though still functional, I've replaced this functionality with Ansible and a better provisioning model IMO: https://github.com/clayshek/raspi-ubuntu-ansible

Summary

Terraform Provisioner for bootstrapping a Raspberry Pi base configuration. This is meant to be a run-once bootstrap Terraform provisioner for a vanilla Raspberry Pi. Provisioners by default run only at resource creation, additional runs without cleanup may introduce problems.

In addtion to bootstrapping, this provisioner also:

  • Installs Prometheus Node Exporter for Prometheus metrics collection
  • Copies the k8s_prep.sh script from this repository to /home/pi/ to optionally install & configure prerequisites for latest ARM release of Kubernetes, including Docker, based off of https://gist.github.com/alexellis/fdbc90de7691a1b9edb545c17da2d975.
  • Copies the helm/install-helm-tiller.sh script from this repo which downloads Helm client, configures Kubernetes RBAC prerequisites, and initiates Helm with an ARM compatible Tiller Docker image.

Requirements

  • Terraform (written with v0.11.3, tested working up to 0.11.11)
  • A newly flashed Raspberry Pi (tested with Raspbian Stretch Lite through 2018-11-13 release, should work with prior version Jessie)
  • SSH access to Pi, See Enable SSH on a headless Raspberry Pi

Usage

  • Clone the repository
  • Customize the parameters in the terraform.tfvars file as applicable for provisioning.
  • Run terraform init (required for first run).
  • Apply the configuration:
terraform apply
  • Optional, run ./k8s_prep.sh to install Kubernetes and prerequisites, including Docker.

  • Optional, once Kubernetes cluster online and functional, run ./helm/install-helm-tiller.sh to install Helm/Tiller.

To-Do

  • Add Prometheus Node Exporter install.
  • Add Helm & Tiller init scripts
  • Possibly add functionality for multiple Raspberry Pi deployments from a single run, using variables with count.
  • Implement tests.

License

This is open-sourced software licensed under the MIT license.