rc 2
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
locals {
|
||||
inventory = {
|
||||
all = {
|
||||
vars = {
|
||||
ansible_user = "cloud"
|
||||
}
|
||||
children = {
|
||||
for svc in distinct([for k, v in var.instances : v.service_name]) :
|
||||
svc => {
|
||||
hosts = {
|
||||
for k, v in var.instances :
|
||||
v.vm_name => {
|
||||
ansible_host = v.ipv4_address
|
||||
}
|
||||
if v.service_name == svc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "local_file" "inventory" {
|
||||
filename = var.filename
|
||||
content = yamlencode(local.inventory)
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
output "filename" {
|
||||
value = local_file.inventory.filename
|
||||
}
|
||||
|
||||
output "content" {
|
||||
value = local_file.inventory.content
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
variable "filename" {
|
||||
description = "Path to write the inventory.yml file"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "instances" {
|
||||
description = "Normalized instance map keyed by instance key"
|
||||
type = map(object({
|
||||
service_name = string
|
||||
vm_name = string
|
||||
ipv4_address = string
|
||||
}))
|
||||
}
|
||||
@@ -4,6 +4,9 @@ variable "pm_api_token" { default = "terraform@pve!provider=760580c4-5c1f-462b-9
|
||||
variable "storage" { default = "hlst" }
|
||||
variable "bridge" { default = "vmbr0" }
|
||||
|
||||
variable "os_type" {
|
||||
default = "alpine"
|
||||
}
|
||||
|
||||
variable "instance_configs" {
|
||||
type = list(object({
|
||||
@@ -104,9 +107,16 @@ variable "vm_name" {
|
||||
default = "Lab"
|
||||
}
|
||||
|
||||
variable "service_name" {
|
||||
description = "Folder name of the services"
|
||||
type = string
|
||||
default = "Lab"
|
||||
}
|
||||
|
||||
variable "vm_user_sshkey" {
|
||||
description = "Admin user SSH key of the VM"
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
|
||||
@@ -133,4 +143,15 @@ variable "vm_user" {
|
||||
description = "Admin user of the VM"
|
||||
type = string
|
||||
default = "cloud"
|
||||
}
|
||||
|
||||
variable "compose_file_content" {
|
||||
description = "Rendered contents of docker-compose.yml to write to the VM"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "env_file_content" {
|
||||
description = "Rendered contents of .env to write to the VM"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
Reference in New Issue
Block a user