All Projects → dmacvicar → Terraform Provider Libvirt

dmacvicar / Terraform Provider Libvirt

Licence: apache-2.0
Terraform provider to provision infrastructure with Linux's KVM using libvirt

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Terraform Provider Libvirt

Tks
Enable enthusiasts and administrators alike to easily provision highly available and production-ready Kubernetes clusters on Proxmox VE.
Stars: ✭ 319 (-64.32%)
Mutual labels:  terraform, virtualization, kvm
Virtlyst
Web interface to manage virtual machines with libvirt
Stars: ✭ 167 (-81.32%)
Mutual labels:  virtualization, kvm, libvirt
Karesansui
Karesansui is an open-source virtualization management application made in Japan.
Stars: ✭ 97 (-89.15%)
Mutual labels:  virtualization, kvm, libvirt
Terrible
An Ansible playbook that apply the principle of the Infrastructure as Code on a QEMU/KVM environment.
Stars: ✭ 161 (-81.99%)
Mutual labels:  terraform, kvm, libvirt
Node Libvirt
libvirt bindings for google v8 javascript engine (nodejs addon)
Stars: ✭ 162 (-81.88%)
Mutual labels:  virtualization, kvm, libvirt
virtnbdbackup
Backup utiliy for Libvirt / qemu / kvm supporting incremental and differencial backups.
Stars: ✭ 62 (-93.06%)
Mutual labels:  virtualization, kvm, libvirt
Ganeti
Ganeti is a virtual machine cluster management tool built on top of existing virtualization technologies such as Xen or KVM and other open source software.
Stars: ✭ 290 (-67.56%)
Mutual labels:  virtualization, kvm
Terraform Provider Digitalocean
Terraform DigitalOcean provider
Stars: ✭ 296 (-66.89%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Aws
Terraform AWS provider
Stars: ✭ 6,624 (+640.94%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Alicloud
Terraform AliCloud provider
Stars: ✭ 340 (-61.97%)
Mutual labels:  terraform, terraform-provider
terraform-provider-terraform
Terraform terraform provider
Stars: ✭ 24 (-97.32%)
Mutual labels:  terraform, terraform-provider
Learn Kvm
Qemu KVM(Kernel Virtual Machine)学习笔记
Stars: ✭ 305 (-65.88%)
Mutual labels:  virtualization, kvm
Terraform Provider Helm
Terraform Helm provider
Stars: ✭ 704 (-21.25%)
Mutual labels:  terraform, terraform-provider
Vmango
Your own personal IaaS cloud
Stars: ✭ 265 (-70.36%)
Mutual labels:  kvm, libvirt
Terraform Provider Ansible
"Logical" provider for integrating with an Ansible Dynamic Inventory script.
Stars: ✭ 262 (-70.69%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Github
Terraform GitHub provider
Stars: ✭ 305 (-65.88%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Kafka
Terraform provider for managing Apache Kafka Topics + ACLs
Stars: ✭ 256 (-71.36%)
Mutual labels:  terraform, terraform-provider
Cc Oci Runtime
OCI (Open Containers Initiative) compatible runtime for Intel® Architecture
Stars: ✭ 418 (-53.24%)
Mutual labels:  virtualization, kvm
Terraform Provider Oci
Terraform Oracle Cloud Infrastructure provider
Stars: ✭ 400 (-55.26%)
Mutual labels:  terraform, terraform-provider
Vmanageplatform
Kvm Manage WebUI
Stars: ✭ 537 (-39.93%)
Mutual labels:  kvm, libvirt

Terraform provider for libvirt

alpha Build Status


This is a terraform provider that lets you provision servers on a libvirt host via Terraform.

Table of Content

Website Docs

Introduction & Goals

This project exists:

  • To allow teams to get the benefits Software Defined Infrastructure Terraform provides, on top of classical and cheap virtualization infrastructure provided by Linux and KVM This helps in very dynamic DevOps, Development and Testing activities.
  • To allow for mixing KVM resources with other infrastructure Terraform is able to manage

What is NOT in scope:

  • To support every advanced feature libvirt supports

    This would make the mapping from terraform complicated and not maintanable. See the How to contribute section to understand how to approach new features.

Downloading

Builds for openSUSE, Ubuntu, and Fedora are created with openSUSE's OBS. The build definitions are available for both the stable and master branches.

Using published binaries/builds

Using packages

Follow the instructions for your distribution:

Building from source

Requirements

  • Terraform
  • Go (to build the provider plugin)
  • libvirt 1.2.14 or newer development headers
  • cgo is required by the libvirt-go package. export CGO_ENABLED="1"

This project uses go modules to declare its dependencies.

Ensure you have the latest version of Go installed on your system, terraform usually takes advantage of features available only inside of the latest stable release.

You also need the libvirt-dev(el) package installed.

Building The Provider

git clone https://github.com/dmacvicar/terraform-provider-libvirt.git
cd terraform-provider-libvirt
make

The binary will be called terraform-provider-libvirt.

Windows

To build it on Windows (64bit) one can use MinGW64 (http://www.msys2.org/)

Install Golang on Windows
Clone terraform-provider-libvirt repository
Open MinGW64 Console

pacman -S mingw-w64-x86_64-libvirt
export PATH=$PATH:/c/Go/bin
pacman -S mingw-w64-x86_64-pkg-config
pacman -S mingw-w64-x86_64-glib2
pacman -S mingw-w64-x86_64-dbus-glib
pacman -S mingw-w64-x86_64-libssh
pacman -S mingw-w64-x86_64-yajl
go install

Installing

  • Check that libvirt daemon 1.2.14 or newer is running on the hypervisor (virsh version --daemon)
  • mkisofs is required to use the CloudInit

Copied from the Terraform documentation:

At present Terraform can automatically install only the providers distributed by HashiCorp. Third-party providers can be manually installed by placing their plugin executables in one of the following locations depending on the host operating system:

On Linux and unix systems, in the sub-path .terraform.d/plugins in your user's home directory.

On Windows, in the sub-path terraform.d/plugins beneath your user's "Application Data" directory.

terraform init will search this directory for additional plugins during plugin initialization.

Using the provider

Here is an example that will setup the following:

  • A virtual server resource

(create this as libvirt.tf and run terraform commands from this directory):

provider "libvirt" {
    uri = "qemu:///system"
}

You can also set the URI in the LIBVIRT_DEFAULT_URI environment variable.

Now, define a libvirt domain:

resource "libvirt_domain" "terraform_test" {
  name = "terraform_test"
}

Now you can see the plan, apply it, and then destroy the infrastructure:

$ terraform init
$ terraform plan
$ terraform apply
$ terraform destroy

Look at more advanced examples here

Using multiple hypervisors / provider instances

You can target different libvirt hosts instantiating the provider multiple times. Example.

Using qemu-agent

From its documentation, qemu-agent:

It is a daemon program running inside the domain which is supposed to help management applications with executing functions which need assistance of the guest OS.

Until terraform-provider-libvirt 0.4.2, qemu-agent was used by default to get network configuration. However, if qemu-agent is not running, this creates a delay until connecting to it times-out.

In current versions, we default to not to attempt connecting to it, and attempting to retrieve network interface information from the agent needs to be enabled explicitly with qemu_agent = true, further details here. Note that you still need to make sure the agent is running in the OS, and that is unrelated to this option.

Note: when using bridge network configurations you need to enable the qemu_agent = true. otherwise you will not retrieve the ip adresses of domains.

Be aware that this variables may be subject to change again in future versions.

Upstream projects using terraform-libvirt:

Authors

See also the list of contributors who participated in this project.

The structure and boilerplate is inspired from the Softlayer and Google Terraform provider sources.

License

  • Apache 2.0, See LICENSE file
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].