diff options
| author | jerome <jerome@xlinfo.fr> | 2025-08-18 11:22:14 +0200 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2025-08-18 11:22:14 +0200 |
| commit | 4293df73e636a3bb9097d4cbe80ae8c194862f6b (patch) | |
| tree | c7cbf89deac7fcbc85850938b7c926778999c9bc /tofu/lots | |
| download | incus-4293df73e636a3bb9097d4cbe80ae8c194862f6b.tar.gz incus-4293df73e636a3bb9097d4cbe80ae8c194862f6b.zip | |
commit initial
Diffstat (limited to 'tofu/lots')
| -rw-r--r-- | tofu/lots/main.tf | 30 | ||||
| -rw-r--r-- | tofu/lots/terraform.tfvars | 3 | ||||
| -rw-r--r-- | tofu/lots/variables.tf | 17 |
3 files changed, 50 insertions, 0 deletions
diff --git a/tofu/lots/main.tf b/tofu/lots/main.tf new file mode 100644 index 0000000..7917a03 --- /dev/null +++ b/tofu/lots/main.tf @@ -0,0 +1,30 @@ +terraform { + required_providers { + incus = { + source = "lxc/incus" + version = "0.3.1" + } + } +} + +provider "incus" { + # Configuration options +} + +resource "incus_instance" "instance" { + name = "${var.nom}${count.index + 1}" + project = "Lab" + image = var.image + count = var.nb + wait_for { + type = "ipv4" + } +} + +output "instance_ip" { + value = { + for instance in incus_instance.instance : + instance.name => instance.ipv4_address + } +} + diff --git a/tofu/lots/terraform.tfvars b/tofu/lots/terraform.tfvars new file mode 100644 index 0000000..3f7d342 --- /dev/null +++ b/tofu/lots/terraform.tfvars @@ -0,0 +1,3 @@ +nb = 3 +nom = "rocky" +image = "images:rockylinux/9/cloud" diff --git a/tofu/lots/variables.tf b/tofu/lots/variables.tf new file mode 100644 index 0000000..f983e48 --- /dev/null +++ b/tofu/lots/variables.tf @@ -0,0 +1,17 @@ +variable "nom" { + description = "nom de la machine" + type = string + default = "debian" +} + +variable "image" { + description = "image source" + type = string + default = "images:debian/12/cloud" +} + +variable "nb" { + description = "nombre de machines" + type = number + default = 2 +} |
