1. Packages
  2. Authentik Provider
  3. API Docs
  4. CertificateKeyPair
authentik 2025.2.0 published on Monday, Mar 24, 2025 by goauthentik

authentik.CertificateKeyPair

Explore with Pulumi AI

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as authentik from "@pulumi/authentik";
import * as tls from "@pulumi/tls";

// Generate a certificate-key pair
const exampletls_private_key = new tls.index.Tls_private_key("exampletls_private_key", {
    algorithm: "ECDSA",
    ecdsaCurve: "P384",
});
const exampletls_self_signed_cert = new tls.index.Tls_self_signed_cert("exampletls_self_signed_cert", {
    keyAlgorithm: "ECDSA",
    privateKeyPem: exampletls_private_key.privateKeyPem,
    subject: [{
        commonName: "example.com",
        organization: "ACME Examples, Inc",
    }],
    validityPeriodHours: 12,
    allowedUses: [
        "key_encipherment",
        "digital_signature",
        "server_auth",
    ],
});
const name = new authentik.CertificateKeyPair("name", {
    certificateData: exampletls_self_signed_cert.certPem,
    keyData: exampletls_private_key.privateKeyPem,
});
Copy
import pulumi
import pulumi_authentik as authentik
import pulumi_tls as tls

# Generate a certificate-key pair
exampletls_private_key = tls.index.Tls_private_key("exampletls_private_key",
    algorithm=ECDSA,
    ecdsa_curve=P384)
exampletls_self_signed_cert = tls.index.Tls_self_signed_cert("exampletls_self_signed_cert",
    key_algorithm=ECDSA,
    private_key_pem=exampletls_private_key.private_key_pem,
    subject=[{
        commonName: example.com,
        organization: ACME Examples, Inc,
    }],
    validity_period_hours=12,
    allowed_uses=[
        key_encipherment,
        digital_signature,
        server_auth,
    ])
name = authentik.CertificateKeyPair("name",
    certificate_data=exampletls_self_signed_cert["certPem"],
    key_data=exampletls_private_key["privateKeyPem"])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/authentik/v2025/authentik"
	"github.com/pulumi/pulumi-tls/sdk/go/tls"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Generate a certificate-key pair
		exampletls_private_key, err := tls.NewTls_private_key(ctx, "exampletls_private_key", &tls.Tls_private_keyArgs{
			Algorithm:  "ECDSA",
			EcdsaCurve: "P384",
		})
		if err != nil {
			return err
		}
		exampletls_self_signed_cert, err := tls.NewTls_self_signed_cert(ctx, "exampletls_self_signed_cert", &tls.Tls_self_signed_certArgs{
			KeyAlgorithm:  "ECDSA",
			PrivateKeyPem: exampletls_private_key.PrivateKeyPem,
			Subject: []map[string]interface{}{
				map[string]interface{}{
					"commonName":   "example.com",
					"organization": "ACME Examples, Inc",
				},
			},
			ValidityPeriodHours: 12,
			AllowedUses: []string{
				"key_encipherment",
				"digital_signature",
				"server_auth",
			},
		})
		if err != nil {
			return err
		}
		_, err = authentik.NewCertificateKeyPair(ctx, "name", &authentik.CertificateKeyPairArgs{
			CertificateData: exampletls_self_signed_cert.CertPem,
			KeyData:         exampletls_private_key.PrivateKeyPem,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Authentik = Pulumi.Authentik;
using Tls = Pulumi.Tls;

return await Deployment.RunAsync(() => 
{
    // Generate a certificate-key pair
    var exampletls_private_key = new Tls.Index.Tls_private_key("exampletls_private_key", new()
    {
        Algorithm = "ECDSA",
        EcdsaCurve = "P384",
    });

    var exampletls_self_signed_cert = new Tls.Index.Tls_self_signed_cert("exampletls_self_signed_cert", new()
    {
        KeyAlgorithm = "ECDSA",
        PrivateKeyPem = exampletls_private_key.PrivateKeyPem,
        Subject = new[]
        {
            
            {
                { "commonName", "example.com" },
                { "organization", "ACME Examples, Inc" },
            },
        },
        ValidityPeriodHours = 12,
        AllowedUses = new[]
        {
            "key_encipherment",
            "digital_signature",
            "server_auth",
        },
    });

    var name = new Authentik.CertificateKeyPair("name", new()
    {
        CertificateData = exampletls_self_signed_cert.CertPem,
        KeyData = exampletls_private_key.PrivateKeyPem,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tls.tls_private_key;
import com.pulumi.tls.Tls_private_keyArgs;
import com.pulumi.tls.tls_self_signed_cert;
import com.pulumi.tls.Tls_self_signed_certArgs;
import com.pulumi.authentik.CertificateKeyPair;
import com.pulumi.authentik.CertificateKeyPairArgs;
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) {
        // Generate a certificate-key pair
        var exampletls_private_key = new Tls_private_key("exampletls_private_key", Tls_private_keyArgs.builder()
            .algorithm("ECDSA")
            .ecdsaCurve("P384")
            .build());

        var exampletls_self_signed_cert = new Tls_self_signed_cert("exampletls_self_signed_cert", Tls_self_signed_certArgs.builder()
            .keyAlgorithm("ECDSA")
            .privateKeyPem(exampletls_private_key.privateKeyPem())
            .subject(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
            .validityPeriodHours(12)
            .allowedUses(            
                "key_encipherment",
                "digital_signature",
                "server_auth")
            .build());

        var name = new CertificateKeyPair("name", CertificateKeyPairArgs.builder()
            .certificateData(exampletls_self_signed_cert.certPem())
            .keyData(exampletls_private_key.privateKeyPem())
            .build());

    }
}
Copy
resources:
  # Generate a certificate-key pair
  exampletls_private_key:
    type: tls:tls_private_key
    properties:
      algorithm: ECDSA
      ecdsaCurve: P384
  exampletls_self_signed_cert:
    type: tls:tls_self_signed_cert
    properties:
      keyAlgorithm: ECDSA
      privateKeyPem: ${exampletls_private_key.privateKeyPem}
      subject:
        - commonName: example.com
          organization: ACME Examples, Inc
      validityPeriodHours: 12
      allowedUses:
        - key_encipherment
        - digital_signature
        - server_auth
  name:
    type: authentik:CertificateKeyPair
    properties:
      certificateData: ${exampletls_self_signed_cert.certPem}
      keyData: ${exampletls_private_key.privateKeyPem}
Copy

Create CertificateKeyPair Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new CertificateKeyPair(name: string, args: CertificateKeyPairArgs, opts?: CustomResourceOptions);
@overload
def CertificateKeyPair(resource_name: str,
                       args: CertificateKeyPairArgs,
                       opts: Optional[ResourceOptions] = None)

@overload
def CertificateKeyPair(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       certificate_data: Optional[str] = None,
                       certificate_key_pair_id: Optional[str] = None,
                       key_data: Optional[str] = None,
                       name: Optional[str] = None)
func NewCertificateKeyPair(ctx *Context, name string, args CertificateKeyPairArgs, opts ...ResourceOption) (*CertificateKeyPair, error)
public CertificateKeyPair(string name, CertificateKeyPairArgs args, CustomResourceOptions? opts = null)
public CertificateKeyPair(String name, CertificateKeyPairArgs args)
public CertificateKeyPair(String name, CertificateKeyPairArgs args, CustomResourceOptions options)
type: authentik:CertificateKeyPair
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. CertificateKeyPairArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. CertificateKeyPairArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. CertificateKeyPairArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. CertificateKeyPairArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. CertificateKeyPairArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var certificateKeyPairResource = new Authentik.CertificateKeyPair("certificateKeyPairResource", new()
{
    CertificateData = "string",
    CertificateKeyPairId = "string",
    KeyData = "string",
    Name = "string",
});
Copy
example, err := authentik.NewCertificateKeyPair(ctx, "certificateKeyPairResource", &authentik.CertificateKeyPairArgs{
	CertificateData:      pulumi.String("string"),
	CertificateKeyPairId: pulumi.String("string"),
	KeyData:              pulumi.String("string"),
	Name:                 pulumi.String("string"),
})
Copy
var certificateKeyPairResource = new CertificateKeyPair("certificateKeyPairResource", CertificateKeyPairArgs.builder()
    .certificateData("string")
    .certificateKeyPairId("string")
    .keyData("string")
    .name("string")
    .build());
Copy
certificate_key_pair_resource = authentik.CertificateKeyPair("certificateKeyPairResource",
    certificate_data="string",
    certificate_key_pair_id="string",
    key_data="string",
    name="string")
Copy
const certificateKeyPairResource = new authentik.CertificateKeyPair("certificateKeyPairResource", {
    certificateData: "string",
    certificateKeyPairId: "string",
    keyData: "string",
    name: "string",
});
Copy
type: authentik:CertificateKeyPair
properties:
    certificateData: string
    certificateKeyPairId: string
    keyData: string
    name: string
Copy

CertificateKeyPair Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The CertificateKeyPair resource accepts the following input properties:

CertificateData This property is required. string
CertificateKeyPairId string
The ID of this resource.
KeyData string
Name string
CertificateData This property is required. string
CertificateKeyPairId string
The ID of this resource.
KeyData string
Name string
certificateData This property is required. String
certificateKeyPairId String
The ID of this resource.
keyData String
name String
certificateData This property is required. string
certificateKeyPairId string
The ID of this resource.
keyData string
name string
certificate_data This property is required. str
certificate_key_pair_id str
The ID of this resource.
key_data str
name str
certificateData This property is required. String
certificateKeyPairId String
The ID of this resource.
keyData String
name String

Outputs

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

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

Look up Existing CertificateKeyPair Resource

Get an existing CertificateKeyPair 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?: CertificateKeyPairState, opts?: CustomResourceOptions): CertificateKeyPair
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        certificate_data: Optional[str] = None,
        certificate_key_pair_id: Optional[str] = None,
        key_data: Optional[str] = None,
        name: Optional[str] = None) -> CertificateKeyPair
func GetCertificateKeyPair(ctx *Context, name string, id IDInput, state *CertificateKeyPairState, opts ...ResourceOption) (*CertificateKeyPair, error)
public static CertificateKeyPair Get(string name, Input<string> id, CertificateKeyPairState? state, CustomResourceOptions? opts = null)
public static CertificateKeyPair get(String name, Output<String> id, CertificateKeyPairState state, CustomResourceOptions options)
resources:  _:    type: authentik:CertificateKeyPair    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
The following state arguments are supported:
CertificateData string
CertificateKeyPairId string
The ID of this resource.
KeyData string
Name string
CertificateData string
CertificateKeyPairId string
The ID of this resource.
KeyData string
Name string
certificateData String
certificateKeyPairId String
The ID of this resource.
keyData String
name String
certificateData string
certificateKeyPairId string
The ID of this resource.
keyData string
name string
certificate_data str
certificate_key_pair_id str
The ID of this resource.
key_data str
name str
certificateData String
certificateKeyPairId String
The ID of this resource.
keyData String
name String

Package Details

Repository
authentik goauthentik/terraform-provider-authentik
License
Notes
This Pulumi package is based on the authentik Terraform Provider.