Skip to content

josh-silvas/terraform-provider-kea

Repository files navigation

Terraform Provider Kea Configuration Backend

This Terraform provider is designed to interact with ISC Kea's Configuration Backend to manage Kea configuration stored in a remote backend such as MySQL or PostgreSQL.

Note: This provider requires the libdhcp_db_cmds.so. hook library to be installed and configured on the Kea server. See the Kea documentation for more information.

This repository is built on Terraform scaffolding for providers and contains the following:

  • A resource and a data source (internal/provider/),
  • Examples (examples/) and generated documentation (docs/),
  • Miscellaneous meta files.

Table of Contents

  1. Requirements
  2. Building The Provider
  3. Adding Dependencies
  4. Using The Provider
  5. Developing The Provider

Requirements

Building The Provider

  1. Clone the repository
  2. Enter the repository directory
  3. Build the provider using the Go install command or the Makefile build target.
make build

Adding Dependencies

This provider uses Go modules. Please see the Go documentation for the most up-to-date information about using Go modules.

To add a new dependency github.com/author/dependency to your Terraform provider:

go get -u github.com/author/dependency
go mod tidy && go mod vendor

Then commit the changes to go.mod and go.sum.

Using the provider

Provider Configuration

provider "kea" {
  username = "some-kea-ctrl-user"
  password = "some-kea-ctrl-password"
}

Data Source Configuration

Remote Subet4 Commands

kea_remote_subnet4_data_source

data "kea_remote_subnet4_data_source" "example" {
  hostname = "kea-primary.example.com"
  prefix   = "192.168.230.0/24"
}

Resource Configuration

Remote Subet4 Commands

kea_remote_subnet4_resource

resource "kea_remote_subnet4_resource" "example" {
  hostname = "kea-primary.example.com"
  subnet   = "192.168.225.0/24"
  pools = [
    { pool = "192.168.225.50-192.168.225.150" }
  ]
  relay = [
    { ip_address = "192.168.225.1" }
  ]
  option_data = [
    { code = 3, name = "routers", data = "192.168.225.1" },
    { code = 15, name = "domain-name", data = "example.com" },
    { code = 6, name = "domain-name-servers", data = "4.2.2.2, 8.8.8.8", always_send = true },
  ]
}

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above).

See the DEVELOPMENT documentation for more information.

Resources

About

A Terraform provider for ISC Kea Configuration Backend

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published