split invariants into seperate module

This commit is contained in:
Pim Kunis 2023-04-05 19:15:03 +02:00
parent 9b70c55033
commit 7aac5730ad
3 changed files with 64 additions and 33 deletions

22
debian/main.tf vendored
View file

@ -6,16 +6,20 @@ terraform {
} }
} }
module "invariants" {
source = "git::https://git.pim.kunis.nl/home/tf-modules.git/invariants"
}
module "tf_debian_vm" { module "tf_debian_vm" {
source = "git::https://git.pim.kunis.nl/pim/tf-debian-vm.git" source = "git::https://git.pim.kunis.nl/pim/tf-debian-vm.git"
name = var.name name = var.name
admin_authorized_keys = var.admin_authorized_keys admin_authorized_keys = coalesce(var.admin_authorized_keys, module.invariants.admin_authorized_keys)
insecure_password = var.insecure_password insecure_password = coalesce(var.insecure_password, false)
use_host_cert = var.use_host_cert use_host_cert = coalesce(var.use_host_cert, true)
disk_pool = var.disk_pool disk_pool = coalesce(var.disk_pool, module.invariants.disk_pool)
disk_base = var.disk_base disk_base = coalesce(var.disk_base, module.invariants.disk_base)
disk_base_pool = var.disk_base_pool disk_base_pool = coalesce(var.disk_base_pool, module.invariants.disk_base_pool)
cloudinit_pool = var.cloudinit_pool cloudinit_pool = coalesce(var.cloudinit_pool, module.invariants.cloudinit_pool)
bridge_name = var.bridge_name bridge_name = coalesce(var.bridge_name, module.invariants.bridge_name)
ca_host = var.ca_host ca_host = coalesce(var.ca_host, module.invariants.ca_host)
} }

21
debian/variables.tf vendored
View file

@ -4,48 +4,45 @@ variable "name" {
variable "admin_authorized_keys" { variable "admin_authorized_keys" {
type = list(string) type = list(string)
default = [ default = null
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOodpLr+FDRyKyHjucHizNLVFHZ5AQmE9GmxMnOsSoaw pimkunis@thinkpadpim",
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINUZp4BCxf7uLa1QWonx/Crf8tYZ5MKIZ+EuaBa82LrV user@user-laptop"
]
} }
variable "insecure_password" { variable "insecure_password" {
type = bool type = bool
default = false default = null
} }
variable "use_host_cert" { variable "use_host_cert" {
type = bool type = bool
default = true default = null
} }
variable "disk_pool" { variable "disk_pool" {
type = string type = string
default = "disk" default = null
} }
variable "disk_base" { variable "disk_base" {
type = string type = string
default = "debian-bookworm.qcow2" default = null
} }
variable "disk_base_pool" { variable "disk_base_pool" {
type = string type = string
default = "iso" default = null
} }
variable "cloudinit_pool" { variable "cloudinit_pool" {
type = string type = string
default = "init" default = null
} }
variable "bridge_name" { variable "bridge_name" {
type = string type = string
default = "dmzbr" default = null
} }
variable "ca_host" { variable "ca_host" {
type = string type = string
default = "hermes.dmz" default = null
} }

30
invariants/outputs.tf Normal file
View file

@ -0,0 +1,30 @@
output "admin_authorized_keys" {
value = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOodpLr+FDRyKyHjucHizNLVFHZ5AQmE9GmxMnOsSoaw pimkunis@thinkpadpim",
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINUZp4BCxf7uLa1QWonx/Crf8tYZ5MKIZ+EuaBa82LrV user@user-laptop"
]
}
output "disk_pool" {
value = "disk"
}
output "disk_base" {
value = "debian-bookworm.qcow2"
}
output "disk_base_pool" {
value = "iso"
}
output "cloudinit_pool" {
value = "init"
}
output "bridge_name" {
value = "dmzbr"
}
output "ca_host" {
value = "hermes.dmz"
}