- Notifications
You must be signed in to change notification settings - Fork0
terraform provider for libvirt
License
MalloZup/terraform-provider-libvirt
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
(IRC gateway)
- Planning board:Github Projects
This is a terraform provider that lets you provisionservers on alibvirt host viaTerraform.
- Introduction and Goals
- Downloading
- Installing
- Quickstart
- Building from source
- How to contribute
- Upstream project using this provider
This project exists:
- To allow teams to get the benefitsSoftware Defined Infrastructure Terraform provides, on top of classical and cheap virtualization infrastructure provided by Linux andKVMThis helps in very dynamicDevOps, Development and Testing activities.
- To allow for mixing KVM resources with other infrastructure Terraform is able to manage
What isNOT in scope:
To support every advanced featurelibvirt supports
This would make the mapping from terraform complicated and not maintanable. See theHow to contribute section to understand how to approach new features.
Builds for openSUSE, CentOS, Ubuntu, Fedora are created with openSUSE'sOBS. The build definitions are available for both thestable andmaster branches.
- Stable releases: Head to thereleases section and download the latest stable release build for your distribution.
- git master builds: Head to thedownload area of the OBS project and download the build for your distribution.
Follow the instructions for your distribution:
- Terraform
- Go (to build the provider plugin)
- libvirt 1.2.14 or newer development headers
cgois required by thelibvirt-go package.export CGO_ENABLED="1"
This project usesgo modules to vendor all itsdependencies.
You do not have to interact withmodules since the vendored packages arealready included in the repo.
Ensure you have the latest version of Go installed on your system, terraform usuallytakes advantage of features available only inside of the latest stable release.
You need also need libvirt-dev(el) package installed.
Clone repository to:$GOPATH/src/github.com/dmacvicar/terraform-provider-libvirt
mkdir -p $GOPATH/src/github.com/dmacvicar; cd $GOPATH/src/github.com/dmacvicargit clone https://github.com/dmacvicar/terraform-provider-libvirt.git
Enter the provider directory and build the provider
cd $GOPATH/src/github.com/dmacvicar/terraform-provider-libvirtmake install
If you are using Go >= 1.11, you don't need to build inside GOPATH:
export GO111MODULE=onexport GOFLAGS=-mod=vendormake installYou will now find the binary at$GOPATH/bin/terraform-provider-libvirt.
- Check that libvirt daemon 1.2.14 or newer is running on the hypervisor (
virsh version --daemon) mkisofsis required to use theCloudInit
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/pluginsin your user's home directory.
On Windows, in the sub-path
terraform.d/pluginsbeneath your user's "Application Data" directory.
terraform init will search this directory for additional plugins during plugin initialization.
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 exampleshere
You can target different libvirt hosts instantiating theprovider multiple times.Example.
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 withqemu_agent = true, further detailshere. 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 theqemu_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.
sumaformsumaform is a way to quickly configure, deploy, testUyuni andSUSE Manager setups with clients and servers.
ha-cluster-sapAutomated HA and SAP Deployments in Public/Private Clouds (including Libvirt/KVM)
ceph-open-terrariumceph-open-terrarium is a way to quickly configure, deploy, tests CEPH cluster without or withDeepsea
- kubic-terraform-kvm Kubic Terraform script using KVM/libvirt
Community Driven Docker ExamplesDocker examples showing how to use the Libvirt Provider
Openshift 4 InstallerThe Openshift 4 Installer uses Terraform for cluster orchestration and relies on terroform-provider-libvirt forlibvirt platform.
- Duncan Mac-Vicar P.dmacvicar@suse.de
See also the list ofcontributors who participated in this project.
The structure and boilerplate is inspired from theSoftlayer andGoogle Terraform provider sources.
- Apache 2.0, See LICENSE file
About
terraform provider for libvirt
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- Go98.3%
- Other1.7%
