get Ssh Key
Get information on a ssh key. This data source provides the name, public key, and fingerprint as configured on your DigitalOcean account. This is useful if the ssh key in question is not managed by the provider or you need to utilize any of the keys data. An error is triggered if the provided ssh key name does not exist.
Example Usage
Get the ssh key:
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetSshKeyArgs;
import com.pulumi.digitalocean.Droplet;
import com.pulumi.digitalocean.DropletArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var exampleSshKey = DigitaloceanFunctions.getSshKey(GetSshKeyArgs.builder()
.name("example")
.build());
var exampleDroplet = new Droplet("exampleDroplet", DropletArgs.builder()
.image("ubuntu-18-04-x64")
.region("nyc2")
.size("s-1vcpu-1gb")
.sshKeys(exampleSshKey.applyValue(getSshKeyResult -> getSshKeyResult.id()))
.build());
}
}
Content copied to clipboard
Return
A collection of values returned by getSshKey.
Parameters
argument
A collection of arguments for invoking getSshKey.
Return
A collection of values returned by getSshKey.
See also
Parameters
name
The name of the ssh key.
Return
A collection of values returned by getSshKey.
See also
Parameters
argument
Builder for com.pulumi.digitalocean.kotlin.inputs.GetSshKeyPlainArgs.