Skip to content

kubevirt/terraform-provider-kubevirt

Terraform Provider

Requirements

  • Terraform 0.12.x
  • Go 1.14 (to build the provider plugin)

Building The Provider

  1. Clone repository

  2. Change directory to repository root folder

  3. Build the project by running make build

$ make build

Using the provider

In order to use it in your computer, run install command inside the repository:

$ make install

You can find examples how to use the provider in _example directory

Contributing to the Provider

Code structure

  • All code located under kubevirt directory
  • Backend kubevirt client wrapper located in client
  • All terraform schema definitions located under schema directory
  • Terraform resource is defined (operations and schema) in kubevirt/resource_*.go for example: virtualmachine resource defined here
  • The main file, which define the provider's flags and structures is provider

Development Environment

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.14+ is required).

To compile the provider, run make build. This will build the provider and put the provider binary in the repository root directory.

$ make build

In order to test the provider, you can simply run make test.

$ make test

In order to run terraform on your computer with terraform-provider-kubevirt, run make install

$ make install

That would build the binary and copy it to $(HOME)/.terraform.d/plugins/$(GOOS)_$(GOARCH)