feat: mostly terraform shenanigans, but TF can now create ssh keys and servers

This commit is contained in:
allanice001
2025-11-02 17:18:28 +00:00
parent 0d10d42442
commit 43f8549320
59 changed files with 6353 additions and 28 deletions

View File

@@ -5,7 +5,7 @@ provider "glueops/autoglue/autoglue" {
version = "0.0.1"
constraints = "0.0.1"
hashes = [
"h1:XW1zYWB6NTuE7jgJwWAkZeBBhL3Me36KE4Puy6lN6+o=",
"h1:K5xMCf5zxZVCurwzkSEAaMv70dzBlVU8VN/q72sNyD0=",
]
}

View File

@@ -1 +1 @@
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"ssh","Source":"../../modules/ssh-key","Dir":"../../modules/ssh-key"}]}
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"servers","Source":"../../modules/servers","Dir":"../../modules/servers"},{"Key":"ssh","Source":"../../modules/ssh-key","Dir":"../../modules/ssh-key"}]}

View File

@@ -27,3 +27,47 @@ output "ssh_public_keys" {
output "ssh_written_files" {
value = { for k, m in module.ssh : k => m.written_files }
}
module "servers" {
source = "../../modules/servers"
# Wire the SSH key IDs so servers can reference them by name
ssh_key_ids = { for k, m in module.ssh : k => m.id }
servers = {
bastion = {
hostname = "bastion-01"
private_ip_address = "10.0.0.10"
public_ip_address = "54.12.34.56" # required for role=bastion
role = "bastion"
ssh_user = "ubuntu"
ssh_key_ref = "bastionKey" # points to module.ssh["bastionKey"].id
status = "pending"
}
manager1 = {
hostname = "k3s-mgr-01"
private_ip_address = "10.0.1.11"
role = "manager"
ssh_user = "ubuntu"
ssh_key_ref = "clusterKey"
status = "pending"
}
agent1 = {
hostname = "k3s-agent-01"
private_ip_address = "10.0.2.21"
role = "agent"
ssh_user = "ubuntu"
ssh_key_ref = "clusterKey"
status = "pending"
}
}
}
output "server_ids" {
value = module.servers.ids
}
output "server_statuses" {
value = module.servers.statuses
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -2,22 +2,22 @@ org_key = "org_lnJwmyyWH7JC-JgZo5v3Kw"
org_secret = "fqd9yebGMfK6h5HSgWn4sXrwr9xlFbvbIYtNylRElMQ"
ssh_keys = {
key1 = {
name = "CI deploy key 1"
comment = "deploy1@autoglue"
bastionKey = {
name = "Bastion Key"
comment = "deploy@autoglue"
type = "rsa"
bits = 4096
enable_download = true
download_part = "both"
download_dir = "out/key1"
download_dir = "out/bastionKey"
}
key2 = {
name = "CI deploy key 2"
comment = "deploy2@autoglue"
clusterKey = {
name = "Cluster Key"
comment = "bastion@autoglue"
type = "ed25519" # bits ignored
enable_download = true
download_part = "both"
download_dir = "out/key2"
download_dir = "out/clusterKey"
}
}