dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.54k stars 457 forks source link

CentOS tf examples #871

Open mahdiarfrm opened 3 years ago

mahdiarfrm commented 3 years ago

hi, i'm new to terraform. i read example files but there was not example due to install centos vm (guest). i want to know are there any differences if you want to install different distro? i'd be happy if you add some basic centos tf configuration on 0.13 .

thanks alot.

inflatador commented 2 years ago

Hello mahdiarfrm , To install CentOS , you need to point terraform to a libvirt-compatible image, such as the qcow2 images found here

Next, create a "libvirt_volume" resource that points to a local or remote copy of your image. I prefer to use local copies:

resource "libvirt_volume" "minecraft_vol" {
  name   = "minecraft_vol"
  pool   = "default"
  format = "qcow2"
  source = "/home/inflatador/images/CentOS-Stream-GenericCloud-8-20210603.0.x86_64.qcow2"
}

From there, configuration is identical to any other distro. Check the examples folder of this repo for specifics. Good luck!