aboutsummaryrefslogtreecommitdiff
path: root/opentofu/inventory.tf
blob: 16d183affcd32a6871296a6a1c1b974d864ddff1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
resource "local_file" "ansible_inventory" {
  filename = "${path.module}/inventory.ini"
  content  = <<-EOT
    [kube_control_plane]
    ${module.k8s_control_plane.vm.default_ipv4_address}

    [etcd]
    ${module.k8s_control_plane.vm.default_ipv4_address}

    [kube_node]
    %{for vm in module.k8s_worker.vms}${vm.default_ipv4_address}
    %{endfor}

    [k8s_cluster:children]
    kube_control_plane
    kube_node
  EOT
}