getPublicKey
Use this data source to get the public key from a PEM-encoded private key for use in other resources.
Example Usage
using System.IO;
using Pulumi;
using Tls = Pulumi.Tls;
class MyStack : Stack
{
public MyStack()
{
var example = Output.Create(Tls.GetPublicKey.InvokeAsync(new Tls.GetPublicKeyArgs
{
PrivateKeyPem = File.ReadAllText("~/.ssh/id_rsa"),
}));
}
}
Coming soon!
import pulumi
import pulumi_tls as tls
example = tls.get_public_key(private_key_pem=(lambda path: open(path).read())("~/.ssh/id_rsa"))
import * as pulumi from "@pulumi/pulumi";
import * as fs from "fs";
import * as tls from "@pulumi/tls";
const example = pulumi.output(tls.getPublicKey({
privateKeyPem: fs.readFileSync("~/.ssh/id_rsa", "utf-8"),
}, { async: true }));
Using getPublicKey
function getPublicKey(args: GetPublicKeyArgs, opts?: InvokeOptions): Promise<GetPublicKeyResult>
def get_public_key(private_key_pem: Optional[str] = None, opts: Optional[InvokeOptions] = None) -> GetPublicKeyResult
func GetPublicKey(ctx *Context, args *GetPublicKeyArgs, opts ...InvokeOption) (*GetPublicKeyResult, error)
Note: This function is named
GetPublicKey
in the Go SDK.
public static class GetPublicKey {
public static Task<GetPublicKeyResult> InvokeAsync(GetPublicKeyArgs args, InvokeOptions? opts = null)
}
The following arguments are supported:
- Private
Key stringPem The private key to use. Currently-supported key types are “RSA” or “ECDSA”.
- Private
Key stringPem The private key to use. Currently-supported key types are “RSA” or “ECDSA”.
- private
Key stringPem The private key to use. Currently-supported key types are “RSA” or “ECDSA”.
- private_
key_ strpem The private key to use. Currently-supported key types are “RSA” or “ECDSA”.
getPublicKey Result
The following output properties are available:
- Algorithm string
- Id string
The provider-assigned unique ID for this managed resource.
- Private
Key stringPem The private key data in PEM format.
- Public
Key stringFingerprint Md5 The md5 hash of the public key data in OpenSSH MD5 hash format, e.g.
aa:bb:cc:...
. Only available if the selected private key format is compatible, as per the rules forpublic_key_openssh
.- Public
Key stringOpenssh The public key data in OpenSSH
authorized_keys
format, if the selected private key format is compatible. All RSA keys are supported, and ECDSA keys with curves “P256”, “P384” and “P521” are supported. This attribute is empty if an incompatible ECDSA curve is selected.- Public
Key stringPem The public key data in PEM format.
- Algorithm string
- Id string
The provider-assigned unique ID for this managed resource.
- Private
Key stringPem The private key data in PEM format.
- Public
Key stringFingerprint Md5 The md5 hash of the public key data in OpenSSH MD5 hash format, e.g.
aa:bb:cc:...
. Only available if the selected private key format is compatible, as per the rules forpublic_key_openssh
.- Public
Key stringOpenssh The public key data in OpenSSH
authorized_keys
format, if the selected private key format is compatible. All RSA keys are supported, and ECDSA keys with curves “P256”, “P384” and “P521” are supported. This attribute is empty if an incompatible ECDSA curve is selected.- Public
Key stringPem The public key data in PEM format.
- algorithm string
- id string
The provider-assigned unique ID for this managed resource.
- private
Key stringPem The private key data in PEM format.
- public
Key stringFingerprint Md5 The md5 hash of the public key data in OpenSSH MD5 hash format, e.g.
aa:bb:cc:...
. Only available if the selected private key format is compatible, as per the rules forpublic_key_openssh
.- public
Key stringOpenssh The public key data in OpenSSH
authorized_keys
format, if the selected private key format is compatible. All RSA keys are supported, and ECDSA keys with curves “P256”, “P384” and “P521” are supported. This attribute is empty if an incompatible ECDSA curve is selected.- public
Key stringPem The public key data in PEM format.
- algorithm str
- id str
The provider-assigned unique ID for this managed resource.
- private_
key_ strpem The private key data in PEM format.
- public_
key_ strfingerprint_ md5 The md5 hash of the public key data in OpenSSH MD5 hash format, e.g.
aa:bb:cc:...
. Only available if the selected private key format is compatible, as per the rules forpublic_key_openssh
.- public_
key_ stropenssh The public key data in OpenSSH
authorized_keys
format, if the selected private key format is compatible. All RSA keys are supported, and ECDSA keys with curves “P256”, “P384” and “P521” are supported. This attribute is empty if an incompatible ECDSA curve is selected.- public_
key_ strpem The public key data in PEM format.
Package Details
- Repository
- https://github.com/pulumi/pulumi-tls
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
tls
Terraform Provider.