Skip to content

cobbler/terraform-provider-cobbler

Repository files navigation

Cobbler Terraform Provider

Codacy Badge

The Cobbler provider is used to interact with a locally installed Cobbler service.
The provider needs to be configured with the proper credentials before it can be used.

Original code by Joe Topjian.

Prerequisites

Using the Provider

Full documentation can be found in the docs directory.

Installation

You can use the provider via the Terraform provider registry.

Manual installation

You can download a pre-built binary from the releases page.
These are built using GoReleaser (the configuration is in the repo).

Download and add the pre-built binary for your system (Linux or macOS) to ~/.terraform.d/plugins/.
Replace linux with darwin for the macOS version.

wget https://github.com/cobbler/terraform-provider-cobbler/releases/download/v2.0.3/terraform-provider-cobbler_2.0.3_linux_amd64.zip
unzip terraform-provider-cobbler_2.0.3_linux_amd64.zip
mkdir -p ~/.terraform.d/plugins/
mv terraform-provider-cobbler_v2.0.3 ~/.terraform.d/plugins/
chmod +x ~/.terraform.d/plugins/terraform-provider-cobbler_v2.0.3

Don't forget to run terraform init after installation of a new binary!

Make sure the file variables.tf contains the right version in the provider block:

provider "cobbler" {
  version  = "~> 4.1.0"
  username = var.cobbler_username
  password = var.cobbler_password
  url      = var.cobbler_url
}

Development

If you want to build from source, you can simply use make in the root of the repository.

Testing

To run the acceptance tests, type make testacc. You will need docker, docker-compose and xorriso installed. Xorriso can be installed using: sudo apt-get install -y xorriso, sudo yum install xorriso -y, or sudo zypper install -y xorriso depending on your distro. The Ubuntu 20.04 ISO will be downloaded idempotently to test importing a distro, this is < 1GB.