瀏覽代碼

working config with terraform-module-vms-hetzner

master
父節點
當前提交
9cc65061a5
共有 2 個檔案被更改,包括 20 行新增16 行删除
  1. +6
    -2
      outputs.tf
  2. +14
    -14
      variables.tf

+ 6
- 2
outputs.tf 查看文件

@@ -1,6 +1,10 @@
output "vms_by_provider" {
value = {

for providername in local.vm_providers: providername => {
for hostname, host in local.vms_with_provider:
hostname => var.vms[hostname]
if host.provider == providername
}
}
}

@@ -23,7 +27,7 @@ output "ansible_inventory" {
for providername in local.vm_providers: "provider_${providername}" => {
hosts = {
for hostname, host in local.vms_with_provider:
hostname => var.providers_hostvars[host.provider].hostvars[hostname]
hostname => var.providers_hostvars[host.provider][hostname]
if host.provider == providername
}
}


+ 14
- 14
variables.tf 查看文件

@@ -1,19 +1,19 @@
variable "vms" {
default = {
"host1.example.com" = {
#provider = "hetzner"
groups = [ "testgroup" ]
volumes = {
data = { size = 32 }
}
}
"host2.example.com" = {
#provider = "hetzner"
groups = [ "testgroup" ]
volumes = {
data = { size = 32 }
}
}
#"host1.example.com" = {
# provider = "hetzner"
# groups = [ "testgroup" ]
# volumes = {
# data = { size = 32 }
# }
#}
#"host2.example.com" = {
# provider = "hetzner"
# groups = [ "testgroup" ]
# volumes = {
# data = { size = 32 }
# }
#}
}
}



Loading…
取消
儲存