|
12345678910111213141516171819202122232425262728293031323334353637383940 |
- variable "vms" {
- default = {}
- }
-
- variable "groups" {
- default = {}
- }
-
- module "vms" {
- source = "./modules/vms"
- vms = var.vms
- groups = var.groups
- providers_hostvars = {
- hetzner = module.vms_hetzner.hostvars
- }
- }
-
- output "vms" {
- value = {
- vms_by_provider = module.vms.vms_by_provider
- ansible_inventory = module.vms.ansible_inventory
- }
- }
-
- variable "hetzner_token" {
- default = {}
- }
-
- module "vms_hetzner" {
- source = "./modules/vms-hetzner"
- vms = module.vms.vms_by_provider.hetzner
- token = var.hetzner_token
- }
-
- resource "local_file" "ansible_inventory" {
- content = jsonencode(module.vms.ansible_inventory)
- filename = "inventory.vms.json"
- file_permission = "0644"
- directory_permission = "0755"
- }
|