WIP
This commit is contained in:
5
example/tofu/.gitignore
vendored
Normal file
5
example/tofu/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.terraform/
|
||||
.terraform.lock.hcl
|
||||
.terraform.tfstate.lock.info
|
||||
terraform.tfstate
|
||||
terraform.tfstate.backup
|
||||
4
example/tofu/cloud-init.yml
Normal file
4
example/tofu/cloud-init.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
users:
|
||||
- name: "root"
|
||||
ssh_authorized_keys:
|
||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOHAAcWecBuLe9gt/NLC5b3DCl68knbwCFcHrH9wPPTk seb@itik.fr"
|
||||
10
example/tofu/infra.auto.tfvars
Normal file
10
example/tofu/infra.auto.tfvars
Normal file
@@ -0,0 +1,10 @@
|
||||
vms = {
|
||||
waf1 = {},
|
||||
waf2 = {},
|
||||
waf3 = {},
|
||||
sql1 = {},
|
||||
nfs1 = {},
|
||||
www1 = {},
|
||||
www2 = {},
|
||||
www3 = {},
|
||||
}
|
||||
11
example/tofu/main.tf
Normal file
11
example/tofu/main.tf
Normal file
@@ -0,0 +1,11 @@
|
||||
provider "multipass" {}
|
||||
|
||||
resource "multipass_instance" "this" {
|
||||
for_each = var.vms
|
||||
name = each.key
|
||||
cpus = each.value.cpus
|
||||
memory = each.value.memory
|
||||
disk = each.value.disk
|
||||
image = each.value.image
|
||||
cloudinit_file = "cloud-init.yml"
|
||||
}
|
||||
8
example/tofu/terraform.tf
Normal file
8
example/tofu/terraform.tf
Normal file
@@ -0,0 +1,8 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
multipass = {
|
||||
source = "larstobi/multipass"
|
||||
version = "1.4.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
9
example/tofu/variables.tf
Normal file
9
example/tofu/variables.tf
Normal file
@@ -0,0 +1,9 @@
|
||||
variable "vms" {
|
||||
description = "Liste des machines virtuelles"
|
||||
type = map(object({
|
||||
cpus = optional(number, 2),
|
||||
memory = optional(string, "3g"),
|
||||
disk = optional(string, "12g"),
|
||||
image = optional(string, "24.04"),
|
||||
}))
|
||||
}
|
||||
Reference in New Issue
Block a user