defines server backup & publicNet

This commit is contained in:
2025-12-29 17:49:40 +01:00
parent cbb6c9034c
commit 6e9506265f

View File

@@ -13,20 +13,13 @@ const serverLabels = {
env: pulumi.getStack(), env: pulumi.getStack(),
}; };
/* const sshPublicKey = config.require("sshPublicKey");
function getSshPublicKey(): hcloud.SshKey {
const sshPublicKey = config.require("sshPublicKey");
return sshKey;
}
*/
const sshPublicKey = config.require("sshPublicKey");
const sshKey = new hcloud.SshKey("ssh-key", { const sshKey = new hcloud.SshKey("ssh-key", {
name: `pulumi-${pulumi.getStack()}-ssh`, name: `pulumi-${pulumi.getStack()}-ssh`,
publicKey: sshPublicKey, publicKey: sshPublicKey,
}); });
export function genServer( export function server(
name: string, name: string,
size: VmSize, size: VmSize,
os: OS = OS.debian, os: OS = OS.debian,
@@ -34,6 +27,7 @@ export function genServer(
network: hcloud.NetworkSubnet network: hcloud.NetworkSubnet
): hcloud.Server { ): hcloud.Server {
const ceap = getCheapestServerType('eu'); const ceap = getCheapestServerType('eu');
const hexId = new random.RandomId(`${name}-${location}`, { const hexId = new random.RandomId(`${name}-${location}`, {
byteLength: 2, // 2 bytes = 4 hex characters byteLength: 2, // 2 bytes = 4 hex characters
}); });
@@ -45,6 +39,11 @@ export function genServer(
image: os, image: os,
serverType: ceap, serverType: ceap,
location, location,
backups: false,
publicNets: [{
ipv4Enabled: false,
ipv6Enabled: true,
}],
networks: [network], networks: [network],
sshKeys: [sshKey.name], sshKeys: [sshKey.name],
labels: serverLabels labels: serverLabels