This message was deleted.
# general
s
This message was deleted.
d
You don't need rsaBits set as that only applies to rsa. It looks like the TLS provider has an output
privateKeyOpenssh
for ssh usage, that should work provided the public key is loaded onto the server https://www.pulumi.com/registry/packages/tls/api-docs/privatekey/#privatekeyopenssh_nodejs
n
@dry-keyboard-94795 Thanks, I made the changes you suggested. I have found the problem though, for some reason my public key is not being added to the authorized_keys for the ansible user in my userData. Can you see anything wrong with my code below.
Copy code
const tlsKey = new tls.PrivateKey("tls-key", {
  algorithm: "ED25519",
});
const publicKey = tlsKey.publicKeyOpenssh

const k3sMaster1 = new hcloud.Server("k3s-master-1", {
  name: "k3s-master-1",
  image: "rocky-9",
  serverType,
  deleteProtection,
  sshKeys: [hKey.name, localKey],
  labels: {
    "k3s-master": "true"
  },
  networks: [{
    networkId: k3sNetwork.id,
    ip: "10.8.8.10"
  }],
  userData: `
#cloud-config
users:
  - name: ansible
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
    ssh_authorized_keys:
      - "${publicKey}"
    sudo: 'ALL=(ALL) NOPASSWD:ALL'
runcmd:
  - sudo yum update -y
  - sudo reboot
  `
}, {
  dependsOn: [k3sNetwork, hKey]
})
d
publicKey here is an
Output<string>
, so you'll need to use something like
pulumi.interpolate
to access the contents. See here: https://www.pulumi.com/docs/concepts/inputs-outputs/#outputs-and-strings
n
Thank you.