https://github.com/tankibaj/libvirt-instance
Terraform module which creates libvirt instance(s)
https://github.com/tankibaj/libvirt-instance
Last synced: 5 months ago
JSON representation
Terraform module which creates libvirt instance(s)
- Host: GitHub
- URL: https://github.com/tankibaj/libvirt-instance
- Owner: tankibaj
- Created: 2021-10-15T15:54:04.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-17T11:31:02.000Z (almost 3 years ago)
- Last Synced: 2025-02-17T21:37:00.223Z (8 months ago)
- Language: HCL
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Terraform module to provision a libvirt instance.
## Usage
**Simple Instnace**
```hcl
module "instance" {
source = "git::https://github.com/tankibaj/libvirt-instance.git"}
```**Single Instance**
```hcl
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**
```hcl
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
}
```## Requirements
| Name | Version |
|------|---------|
| [libvirt](https://github.com/dmacvicar/terraform-provider-libvirt) | 0.6.11 |
| [terraform](https://www.terraform.io/downloads.html) | 0.15+ |
## Provider
| Name | Version |
|------|---------|
| [libvirt](https://github.com/dmacvicar/terraform-provider-libvirt) | 0.6.11 |
## Resources
| Name | Type |
|------|------|
| [libvirt_cloudinit_disk.this](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs/resources/cloudinit) | resource |
| [libvirt_domain.this](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs/resources/domain) | resource |
| [libvirt_network.this](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs/resources/network) | resource |
| [libvirt_pool.this](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs/resources/pool) | resource |
| [libvirt_volume.base_volume](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs/resources/volume) | resource |
| [libvirt_volume.root_volume](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs/resources/volume) | resource |
| [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource |
| [random_uuid.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid) | resource |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [autostart](#input\_autostart) | Whether instance will be auto started or not | `string` | `"true"` | no |
| [base\_volume\_id](#input\_base\_volume\_id) | ID of base OS image if already exist | `string` | `""` | no |
| [graphics\_type](#input\_graphics\_type) | Type of graphics emulation. spice \| vnc | `string` | `"vnc"` | no |
| [image\_path](#input\_image\_path) | OS image path/url to provision instance | `string` | `""` | no |
| [memory](#input\_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](#input\_name) | Name to be used on EC2 instance created | `string` | `""` | no |
| [network\_config](#input\_network\_config) | Cloud-init network config | `string` | `""` | no |
| [network\_name](#input\_network\_name) | Name of network to associate with instance | `string` | `""` | no |
| [network\_wait\_for\_lease](#input\_network\_wait\_for\_lease) | Whether instance will be wait for the DHCP IP lease | `bool` | `false` | no |
| [pool\_name](#input\_pool\_name) | Name of pool where all volumes will stored | `string` | `""` | no |
| [pool\_path](#input\_pool\_path) | Path of pool where all volumes will stored | `string` | `""` | no |
| [root\_volume\_id](#input\_root\_volume\_id) | ID of root volume if already exist | `string` | `""` | no |
| [user\_data](#input\_user\_data) | Cloud-init user data | `string` | `""` | no |
| [vcpu](#input\_vcpu) | The amount of virtual CPUs. If not specified, a single CPU will be created | `number` | `1` | no |
| [volume\_size](#input\_volume\_size) | The size of the volume in GB | `number` | `5` | no |
## Outputs
| Name | Description |
|------|-------------|
| [name](#output\_name) | Instance name |