terraform-libvirt/base/libvirtd.tf

63 lines
1.5 KiB
HCL

# https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r
terraform {
required_providers {
null = {
source = "hashicorp/null"
version = "~> 2.1"
}
template = {
source = "hashicorp/template"
version = "~> 2.1"
}
libvirt = {
source = "dmacvicar/libvirt"
version = ">= 0.6.3"
}
}
backend "etcdv3" {
endpoints = ["https://100.64.0.19:2379"]
lock = true
prefix = "/terraform-state/"
cacert_path = "/home/antoine/virtualization/kubernetes-the-hard-way/certs/ca.pem"
cert_path = "/home/antoine/virtualization/kubernetes-the-hard-way/certs/kubernetes.pem"
key_path = "/home/antoine/virtualization/kubernetes-the-hard-way/certs/kubernetes-key.pem"
}
}
provider "libvirt" {
uri = "qemu+tcp://dx30.localdomain/system"
}
resource "libvirt_pool" "pool_1" {
name = "pool_1"
type = "dir"
path = "/var/lib/libvirt/pool/pool_1"
}
resource "libvirt_volume" "centos7_qcow2" {
name = "centos7.qcow2"
pool = libvirt_pool.pool_1.name
source = "./images/CentOS-7-x86_64-GenericCloud.qcow2"
format = "qcow2"
}
resource "libvirt_volume" "debian_buster_qcow2" {
name = "debian-openstack-buster.qcow2"
pool = libvirt_pool.pool_1.name
source = "./images/debian-10-openstack-amd64.qcow2"
format = "qcow2"
}
resource "libvirt_volume" "debian_with_docker_qcow2" {
name = "debian-10.7.0-with-docker.qcow2"
pool = libvirt_pool.pool_1.name
source = "./images/debian-10.7.0_packer.qcow2"
format = "qcow2"
}