fix: derive k3s node IPs from terraform private addresses
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -27,9 +26,34 @@ def get_terraform_outputs():
|
||||
def main():
|
||||
outputs = get_terraform_outputs()
|
||||
|
||||
control_plane_ips = outputs["control_plane_ips"]["value"]
|
||||
control_plane_private_ips = outputs["control_plane_private_ips"]["value"]
|
||||
worker_ips = outputs["worker_ips"]["value"]
|
||||
worker_private_ips = outputs["worker_private_ips"]["value"]
|
||||
|
||||
control_planes = [
|
||||
{
|
||||
"name": f"cp-{i + 1}",
|
||||
"public_ip": public_ip,
|
||||
"private_ip": private_ip,
|
||||
}
|
||||
for i, (public_ip, private_ip) in enumerate(
|
||||
zip(control_plane_ips, control_plane_private_ips)
|
||||
)
|
||||
]
|
||||
|
||||
workers = [
|
||||
{
|
||||
"name": f"worker-{i + 1}",
|
||||
"public_ip": public_ip,
|
||||
"private_ip": private_ip,
|
||||
}
|
||||
for i, (public_ip, private_ip) in enumerate(zip(worker_ips, worker_private_ips))
|
||||
]
|
||||
|
||||
data = {
|
||||
"control_plane_ips": outputs["control_plane_ips"]["value"],
|
||||
"worker_ips": outputs["worker_ips"]["value"],
|
||||
"control_planes": control_planes,
|
||||
"workers": workers,
|
||||
"private_key_file": outputs["ssh_private_key_path"]["value"],
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user