Skip to content

goffinet/terraform-libvirt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform with Libvirt/KVM provider

Terraforms examples with terraform-provider-libvirt.

I use qemu/KVM images built with packer thanks to this project : packer-kvm. They are regularly published on a website.

Only for education and learning purposes. Do not use it in production.

What is Terraform?

Terraform is an Infrastructure as Code (IaC) tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.

Configuration files describe to Terraform the components needed to run a single application or your entire datacenter. Terraform generates an execution plan describing what it will do to reach the desired state, and then executes it to build the described infrastructure. As the configuration changes, Terraform is able to determine what changed and create incremental execution plans which can be applied.

The infrastructure Terraform can manage includes low-level components such as compute instances, storage, and networking, as well as high-level components such as DNS entries, SaaS features, etc.What is Terraform?

Here we use the third party terraform-provider-libvirt to manage Libvirt resources as networks, storage pools, volumes, template for cloud-init iso disk with count functions and any provisioners.

Local installation

Setup a local installation on your virtualization host with Libvirt, Terraform and the Libvirt provider plugin for Terraform (Ubuntu bionic) :

git clone https://github.com/goffinet/terraform-libvirt
cd terraform-libvirt/
bash -x setup.sh

Projects

Deploy with terraform

git clone https://github.com/goffinet/terraform-libvirt
cd terraform-libvirt/basics/ubuntu
terraform plan

Use Docker

cd terraform-libvirt/basics/ubuntu
docker run --rm --privileged --cap-add=ALL \
-v /lib/modules:/lib/modules \
-v /var/lib/libvirt:/var/lib/libvirt \
-v /var/log:/var/log \
-v /run:/run \
-v `pwd`:/opt/ \
-w /opt/ \
-it \
goffinet/terraform terraform init

Deploy a routing lab with Terraform on Libvirt/KVM

See this routing lab with 8 VMs.

References

About

Terraforms examples with terraform-provider-libvirt

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published