https://pulumi.com logo
Title
i

important-sandwich-62391

05/08/2021, 10:16 PM
Using Go - I want to generate a new SSH Key Pair, and store it in an Output — but only once (eg, don’t regenerate it every pulumi up). I’m looking at Resources but not really seeing how you could do this? There isn’t really a way to access your existing Outputs from a stack is there?
b

billowy-army-68599

05/09/2021, 12:55 AM
Hello @important-sandwich-62391 - it's actually possible to do this using the TLS provider. Here's an example: https://github.com/jaxxstorm/pulumi-examples/blob/master/go/misc/ssh_keys/main.go
here's an example of what it generates:
Outputs:
    privateKey: "[secret]"
    publicKey : "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6nJ9yyf6OeLaP82IeEWVSFNjNX+NT5ULQL0bQlSODtUDoBJAlyeC1vWdtP6ln0nca7wn0Xy4XOkKeYl5pdOLRMOwL9CdR1pr13xZCTCAf3j348kFu2RSjZknCy8Odf/omr/K81RBCQIA2HcdyoibkG+60Zg60nkw3uUF3B9JASU6c5b/hdwgORrDdOMelOtlGuARAFjrqMlXdbAbte3uyOCq6JBHxmnoMZv7XXvOOxgbNqIKUNJ4gXqigFYW2ndx1265b6RV4i81KVzASkfo3vXNJc7SJ2jMzTnIrjdBKMjqM2q63AJMV2Qkhgn8P7/aBiw7sf8HxeQX54bCvUCH6acP2sUIwc5Rx4o+x8hAOUQgkSwQaQAjvb/miKAg6AMqGe1WTLh6k9XlnJkDs23OnsnXtZZoPDW88IQTl6gGSZk9xEzNKBneStM+HQ3xV0pTBUWMzP9AUx/vCgDn8aNpShMllKqfo0S5U57W6mG1boAMUWNKJvVJGrv2sadOnD3br0Y6IdixnIemfjZ+X2cJVyd97Wat0EZfuf2gg8bXtT4nimNDv3OPBqSsfoHn5WMvv+W5B7FJnVnN5h2EfJ9lpCE/QzVpLo3x4XivtyY+UuUqnzW0wz2XDBqjNFNn+xAcUjb3to5dKr9IzNydtINh7kRjOLiXiggz2g5GdorX/oQ==\n"
i

important-sandwich-62391

05/09/2021, 6:50 PM
thank you for the concrete example. it works. though… i’m stil curious about how you would make a custom resource? semes like its not quite viable in Go yet?