Terraform module to provision a libvirt instance.
Simple Instnace
module "instance" {
source = "git::https://github.com/tankibaj/libvirt-instance.git"
}
Single Instance
resource "libvirt_network" "this" {
name = "my-network"
mode = "bridge"
bridge = "br0"
autostart = true
}
module "instance" {
source = "git::https://github.com/tankibaj/libvirt-instance.git"
name = "my-instance"
memory = 512
vcpu = 1
volume_size = 8
network_name = libvirt_network.this.name
}
Multiple Instance
resource "libvirt_network" "this" {
name = "k8s-cluster"
mode = "bridge"
bridge = "br0"
autostart = true
}
module "instance" {
source = "git::https://github.com/tankibaj/libvirt-instance.git"
count = 2
name = "k8s-node${count.index + 1}"
memory = 1024
vcpu = 1
volume_size = 10
image_path = "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
network_name = libvirt_network.this.name
}
Name | Version |
---|---|
libvirt | 0.6.11 |
terraform | 0.15+ |
Name | Version |
---|---|
libvirt | 0.6.11 |
Name | Type |
---|---|
libvirt_cloudinit_disk.this | resource |
libvirt_domain.this | resource |
libvirt_network.this | resource |
libvirt_pool.this | resource |
libvirt_volume.base_volume | resource |
libvirt_volume.root_volume | resource |
random_pet.this | resource |
random_uuid.this | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
autostart | Whether instance will be auto started or not | string |
"true" |
no |
base_volume_id | ID of base OS image if already exist | string |
"" |
no |
graphics_type | Type of graphics emulation. spice | vnc | string |
"vnc" |
no |
image_path | OS image path/url to provision instance | string |
"" |
no |
memory | The amount of memory in MiB. If not specified the domain will be created with 512 MiB of memory be used | number |
512 |
no |
name | Name to be used on EC2 instance created | string |
"" |
no |
network_config | Cloud-init network config | string |
"" |
no |
network_name | Name of network to associate with instance | string |
"" |
no |
network_wait_for_lease | Whether instance will be wait for the DHCP IP lease | bool |
false |
no |
pool_name | Name of pool where all volumes will stored | string |
"" |
no |
pool_path | Path of pool where all volumes will stored | string |
"" |
no |
root_volume_id | ID of root volume if already exist | string |
"" |
no |
user_data | Cloud-init user data | string |
"" |
no |
vcpu | The amount of virtual CPUs. If not specified, a single CPU will be created | number |
1 |
no |
volume_size | The size of the volume in GB | number |
5 |
no |
Name | Description |
---|---|
name | Instance name |