tls_public_key (Data Source)

Get a public key from a PEM-encoded private key.

Use this data source to get the public key from a PEM (RFC 1421) or OpenSSH PEM (RFC 4716) formatted private key, for use in other resources.

Example Usage

// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
import { Construct } from "constructs";
import { Fn, Token, TerraformStack } from "cdktf";
/*
 * Provider bindings are generated by running `cdktf get`.
 * See https://cdk.tf/provider-generation for more details.
 */
import { DataTlsPublicKey } from "./.gen/providers/tls/data-tls-public-key";
import { PrivateKey } from "./.gen/providers/tls/private-key";
class MyConvertedCode extends TerraformStack {
  constructor(scope: Construct, name: string) {
    super(scope, name);
    const ed25519Example = new PrivateKey(this, "ed25519-example", {
      algorithm: "ED25519",
    });
    new DataTlsPublicKey(this, "private_key_openssh-example", {
      privateKeyOpenssh: Token.asString(Fn.file("~/.ssh/id_rsa_rfc4716")),
    });
    new DataTlsPublicKey(this, "private_key_pem-example", {
      privateKeyPem: ed25519Example.privateKeyPem,
    });
  }
}

Schema

Optional

Read-Only