Skip to content

Commit

Permalink
Improve setup instructions to use 3rd party plugin directory
Browse files Browse the repository at this point in the history
  • Loading branch information
dghubble committed Feb 11, 2019
1 parent df3ac83 commit aaab188
Showing 1 changed file with 38 additions and 18 deletions.
56 changes: 38 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,59 @@
# Matchbox Terraform Provider
# terraform-provider-matchbox

The Matchbox provider is used to interact with the [matchbox](https://github.com/coreos/matchbox) API. Matchbox matches bare-metal machines by labels (e.g. MAC address) to Profiles with iPXE configs, Container Linux configs, or generic free-form configs in order to provision clusters.
`terraform-provider-matchbox` allows defining CoreOS [Matchbox](https://github.com/coreos/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.

## Usage
## Requirements

* Terraform v0.11+ [installed](https://www.terraform.io/downloads.html)
* Matchbox v0.6+ [installed](https://coreos.com/matchbox/docs/latest/deployment.html) (v0.7+ to use the `generic_config` field)
* Matchbox credentials `client.crt`, `client.key`, `ca.crt`

A Matchbox v0.6+ [installation](https://coreos.com/matchbox/docs/latest/deployment.html) is required. Matchbox v0.7+ is required to use the `generic_config` field.
## Install

Install [Terraform](https://www.terraform.io/downloads.html) v0.9+ Add the `terraform-provider-matchbox` plugin binary somewhere on your filesystem.
Add the `terraform-provider-matchbox` plugin binary for your system to the Terraform 3rd-party [plugin directory](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins) `~/.terraform.d/plugins`.

```sh
# dev
go get -u github.com/coreos/terraform-provider-matchbox
VERSION=v0.2.2
wget https://github.com/coreos/terraform-provider-matchbox/releases/download/$VERSION/terraform-provider-matchbox-$VERSION-linux-amd64.tar.gz
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
```

Register the plugin in `~/.terraformrc`.
Terraform plugin binary names are versioned to allow for migrations of managed infrastructure.

```hcl
providers {
matchbox = "/path/to/terraform-provider-matchbox"
}
```
$ tree ~/.terraform.d/
/home/user/.terraform.d/
└── plugins
├── terraform-provider-matchbox_v0.2.1
└── terraform-provider-matchbox_v0.2.2
```

On-premise, [setup](https://coreos.com/matchbox/docs/latest/network-setup.html) a PXE network boot environment. [Install matchbox](https://coreos.com/matchbox/docs/latest/deployment.html) on a provisioner node or Kubernetes cluster. Be sure to enable the gRPC API and follow the instructions to generate TLS credentials.
## Usage

[Setup](https://coreos.com/matchbox/docs/latest/network-setup.html) a PXE network boot environment and [deploy](https://coreos.com/matchbox/docs/latest/deployment.html) a Matchbox instance. Be sure to enable the gRPC API and follow the instructions to generate TLS credentials.

### Examples
Configure the Matchbox provider to use your Matchbox API endpoint and client certificate in a `providers.tf` file.

```tf
// Configure the matchbox provider
provider "matchbox" {
endpoint = "${var.matchbox_rpc_endpoint}"
version = "0.2.2"
endpoint = "matchbox.example.com:8081"
client_cert = "${file("~/.matchbox/client.crt")}"
client_key = "${file("~/.matchbox/client.key")}"
ca = "${file("~/.matchbox/ca.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.

```tf
// Create a Container Linux install profile
resource "matchbox_profile" "container-linux-install" {
name = "container-linux-install"
Expand Down

0 comments on commit aaab188

Please sign in to comment.