# tls.PrivateKey

## Create PrivateKey Resource

`new PrivateKey(name: string, args: PrivateKeyArgs, opts?: CustomResourceOptions);`

```
@overload
def PrivateKey(resource_name: str,
opts: Optional[ResourceOptions] = None,
algorithm: Optional[str] = None,
ecdsa_curve: Optional[str] = None,
rsa_bits: Optional[int] = None)
@overload
def PrivateKey(resource_name: str,
args: PrivateKeyArgs,
opts: Optional[ResourceOptions] = None)
```

`func NewPrivateKey(ctx *Context, name string, args PrivateKeyArgs, opts ...ResourceOption) (*PrivateKey, error)`

`public PrivateKey(string name, PrivateKeyArgs args, CustomResourceOptions? opts = null)`

```
public PrivateKey(String name, PrivateKeyArgs args)
public PrivateKey(String name, PrivateKeyArgs args, CustomResourceOptions options)
```

```
type: tls:PrivateKey
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
```

- name string
- The unique name of the resource.
- args PrivateKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.

- resource_name str
- The unique name of the resource.
- args PrivateKeyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.

- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PrivateKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.

- name string
- The unique name of the resource.
- args PrivateKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.

- name String
- The unique name of the resource.
- args PrivateKeyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.

## PrivateKey Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

### Inputs

The PrivateKey resource accepts the following input properties:

- Algorithm string
Name of the algorithm to use when generating the private key. Currently-supported values are

`RSA`

,`ECDSA`

and`ED25519`

.- Ecdsa
Curve string When

`algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- Rsa
Bits int When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

- Algorithm string
Name of the algorithm to use when generating the private key. Currently-supported values are

`RSA`

,`ECDSA`

and`ED25519`

.- Ecdsa
Curve string When

`algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- Rsa
Bits int When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

- algorithm String
Name of the algorithm to use when generating the private key. Currently-supported values are

`RSA`

,`ECDSA`

and`ED25519`

.- ecdsa
Curve String When

`algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- rsa
Bits Integer When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

- algorithm string
`RSA`

,`ECDSA`

and`ED25519`

.- ecdsa
Curve string `algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- rsa
Bits number When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

- algorithm str
`RSA`

,`ECDSA`

and`ED25519`

.- ecdsa_
curve str `algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- rsa_
bits int When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

- algorithm String
`RSA`

,`ECDSA`

and`ED25519`

.- ecdsa
Curve String `algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- rsa
Bits Number When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

### Outputs

All input properties are implicitly available as output properties. Additionally, the PrivateKey resource produces the following output properties:

- Id string
The provider-assigned unique ID for this managed resource.

- Private
Key stringOpenssh Private key data in OpenSSH PEM (RFC 4716) format.

- Private
Key stringPem Private key data in PEM (RFC 1421) format.

- Public
Key stringFingerprint Md5 The fingerprint 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, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- Public
Key stringFingerprint Sha256 The fingerprint of the public key data in OpenSSH SHA256 hash format, e.g.

`SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- Public
Key stringOpenssh The public key data in "Authorized Keys" format. This is populated only if the configured private key is supported: this includes all

`RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- Public
Key stringPem Public key data in PEM (RFC 1421) format.

**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.

- Id string
The provider-assigned unique ID for this managed resource.

- Private
Key stringOpenssh Private key data in OpenSSH PEM (RFC 4716) format.

- Private
Key stringPem Private key data in PEM (RFC 1421) format.

- Public
Key stringFingerprint Md5 The fingerprint 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, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- Public
Key stringFingerprint Sha256 The fingerprint of the public key data in OpenSSH SHA256 hash format, e.g.

`SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- Public
Key stringOpenssh The public key data in "Authorized Keys" format. This is populated only if the configured private key is supported: this includes all

`RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- Public
Key stringPem Public key data in PEM (RFC 1421) format.

**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.

- id String
The provider-assigned unique ID for this managed resource.

- private
Key StringOpenssh Private key data in OpenSSH PEM (RFC 4716) format.

- private
Key StringPem Private key data in PEM (RFC 1421) format.

- public
Key StringFingerprint Md5 The fingerprint 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, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key StringFingerprint Sha256 The fingerprint of the public key data in OpenSSH SHA256 hash format, e.g.

`SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key StringOpenssh The public key data in "Authorized Keys" format. This is populated only if the configured private key is supported: this includes all

`RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- public
Key StringPem Public key data in PEM (RFC 1421) format.

**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.

- id string
The provider-assigned unique ID for this managed resource.

- private
Key stringOpenssh Private key data in OpenSSH PEM (RFC 4716) format.

- private
Key stringPem Private key data in PEM (RFC 1421) format.

- public
Key stringFingerprint Md5 `aa:bb:cc:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key stringFingerprint Sha256 `SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key stringOpenssh `RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- public
Key stringPem **NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.

- id str
The provider-assigned unique ID for this managed resource.

- private_
key_ stropenssh Private key data in OpenSSH PEM (RFC 4716) format.

- private_
key_ strpem Private key data in PEM (RFC 1421) format.

- public_
key_ strfingerprint_ md5 `aa:bb:cc:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public_
key_ strfingerprint_ sha256 `SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public_
key_ stropenssh `RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- public_
key_ strpem **NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.

- id String
The provider-assigned unique ID for this managed resource.

- private
Key StringOpenssh Private key data in OpenSSH PEM (RFC 4716) format.

- private
Key StringPem Private key data in PEM (RFC 1421) format.

- public
Key StringFingerprint Md5 `aa:bb:cc:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key StringFingerprint Sha256 `SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key StringOpenssh `RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- public
Key StringPem **NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.

## Look up Existing PrivateKey Resource

Get an existing PrivateKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

`public static get(name: string, id: Input<ID>, state?: PrivateKeyState, opts?: CustomResourceOptions): PrivateKey`

```
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
algorithm: Optional[str] = None,
ecdsa_curve: Optional[str] = None,
private_key_openssh: Optional[str] = None,
private_key_pem: Optional[str] = None,
public_key_fingerprint_md5: Optional[str] = None,
public_key_fingerprint_sha256: Optional[str] = None,
public_key_openssh: Optional[str] = None,
public_key_pem: Optional[str] = None,
rsa_bits: Optional[int] = None) -> PrivateKey
```

`func GetPrivateKey(ctx *Context, name string, id IDInput, state *PrivateKeyState, opts ...ResourceOption) (*PrivateKey, error)`

`public static PrivateKey Get(string name, Input<string> id, PrivateKeyState? state, CustomResourceOptions? opts = null)`

`public static PrivateKey get(String name, Output<String> id, PrivateKeyState state, CustomResourceOptions options)`

`Resource lookup is not supported in YAML`

- name
- The unique name of the resulting resource.
- id
- The
*unique*provider ID of the resource to lookup. - state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.

- resource_name
- The unique name of the resulting resource.
- id
- The
*unique*provider ID of the resource to lookup.

- name
- The unique name of the resulting resource.
- id
- The
*unique*provider ID of the resource to lookup. - state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.

- name
- The unique name of the resulting resource.
- id
- The
*unique*provider ID of the resource to lookup. - state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.

- name
- The unique name of the resulting resource.
- id
- The
*unique*provider ID of the resource to lookup. - state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.

- Algorithm string
`RSA`

,`ECDSA`

and`ED25519`

.- Ecdsa
Curve string `algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- Private
Key stringOpenssh Private key data in OpenSSH PEM (RFC 4716) format.

- Private
Key stringPem Private key data in PEM (RFC 1421) format.

- Public
Key stringFingerprint Md5 `aa:bb:cc:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- Public
Key stringFingerprint Sha256 `SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- Public
Key stringOpenssh `RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- Public
Key stringPem **NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- Rsa
Bits int When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

- Algorithm string
`RSA`

,`ECDSA`

and`ED25519`

.- Ecdsa
Curve string `algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- Private
Key stringOpenssh Private key data in OpenSSH PEM (RFC 4716) format.

- Private
Key stringPem Private key data in PEM (RFC 1421) format.

- Public
Key stringFingerprint Md5 `aa:bb:cc:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- Public
Key stringFingerprint Sha256 `SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- Public
Key stringOpenssh `RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- Public
Key stringPem **NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- Rsa
Bits int When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

- algorithm String
`RSA`

,`ECDSA`

and`ED25519`

.- ecdsa
Curve String `algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- private
Key StringOpenssh Private key data in OpenSSH PEM (RFC 4716) format.

- private
Key StringPem Private key data in PEM (RFC 1421) format.

- public
Key StringFingerprint Md5 `aa:bb:cc:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key StringFingerprint Sha256 `SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key StringOpenssh `RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- public
Key StringPem **NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- rsa
Bits Integer When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

- algorithm string
`RSA`

,`ECDSA`

and`ED25519`

.- ecdsa
Curve string `algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- private
Key stringOpenssh Private key data in OpenSSH PEM (RFC 4716) format.

- private
Key stringPem Private key data in PEM (RFC 1421) format.

- public
Key stringFingerprint Md5 `aa:bb:cc:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key stringFingerprint Sha256 `SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key stringOpenssh `RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- public
Key stringPem **NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- rsa
Bits number When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

- algorithm str
`RSA`

,`ECDSA`

and`ED25519`

.- ecdsa_
curve str `algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- private_
key_ stropenssh Private key data in OpenSSH PEM (RFC 4716) format.

- private_
key_ strpem Private key data in PEM (RFC 1421) format.

- public_
key_ strfingerprint_ md5 `aa:bb:cc:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public_
key_ strfingerprint_ sha256 `SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public_
key_ stropenssh `RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- public_
key_ strpem **NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- rsa_
bits int When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

- algorithm String
`RSA`

,`ECDSA`

and`ED25519`

.- ecdsa
Curve String `algorithm`

is`ECDSA`

, the name of the elliptic curve to use. Currently-supported values are`P224`

,`P256`

,`P384`

or`P521`

(default:`P224`

).- private
Key StringOpenssh Private key data in OpenSSH PEM (RFC 4716) format.

- private
Key StringPem Private key data in PEM (RFC 1421) format.

- public
Key StringFingerprint Md5 `aa:bb:cc:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key StringFingerprint Sha256 `SHA256:...`

. Only available if the selected private key format is compatible, similarly to`public_key_openssh`

and the ECDSA P224 limitations.- public
Key StringOpenssh `RSA`

and`ED25519`

keys, as well as`ECDSA`

keys with curves`P256`

,`P384`

and`P521`

.`ECDSA`

with curve`P224`

is not supported.**NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- public
Key StringPem **NOTE**: the underlying libraries that generate this value append a`\n`

at the end of the PEM. In case this disrupts your use case, we recommend using`trimspace()`

.- rsa
Bits Number When

`algorithm`

is`RSA`

, the size of the generated RSA key, in bits (default:`2048`

).

## Package Details

- Repository
- TLS pulumi/pulumi-tls
- License
- Apache-2.0
- Notes
This Pulumi package is based on the

`tls`

Terraform Provider.