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

28
debian/main.tf vendored
View file

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

39
debian/variables.tf vendored
View file

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