Use this data source to get the public key from a PEM-encoded private key for use in other resources.
data "tls_public_key" "example" { private_key_pem = "${file("~/.ssh/id_rsa")}" }
The following arguments are supported:
private_key_pem
- (Required) The private key to use. Currently-supported key types are "RSA" or "ECDSA". The following attributes are exported:
private_key_pem
- The private key data in PEM format. public_key_pem
- The public key data in PEM format. public_key_openssh
- 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 "P251" are supported. This attribute is empty if an incompatible ECDSA curve is selected.
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/tls/d/public_key.html