tls logo
TLS v4.8.0, Jan 27 23

tls.CertRequest

Example Usage

using System.Collections.Generic;
using System.IO;
using Pulumi;
using Tls = Pulumi.Tls;

return await Deployment.RunAsync(() => 
{
    var example = new Tls.CertRequest("example", new()
    {
        PrivateKeyPem = File.ReadAllText("private_key.pem"),
        Subject = new Tls.Inputs.CertRequestSubjectArgs
        {
            CommonName = "example.com",
            Organization = "ACME Examples, Inc",
        },
    });

});
package main

import (
	"io/ioutil"

	"github.com/pulumi/pulumi-tls/sdk/v4/go/tls"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := tls.NewCertRequest(ctx, "example", &tls.CertRequestArgs{
			PrivateKeyPem: readFileOrPanic("private_key.pem"),
			Subject: &tls.CertRequestSubjectArgs{
				CommonName:   pulumi.String("example.com"),
				Organization: pulumi.String("ACME Examples, Inc"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tls.CertRequest;
import com.pulumi.tls.CertRequestArgs;
import com.pulumi.tls.inputs.CertRequestSubjectArgs;
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) {
        var example = new CertRequest("example", CertRequestArgs.builder()        
            .privateKeyPem(Files.readString(Paths.get("private_key.pem")))
            .subject(CertRequestSubjectArgs.builder()
                .commonName("example.com")
                .organization("ACME Examples, Inc")
                .build())
            .build());

    }
}
import pulumi
import pulumi_tls as tls

example = tls.CertRequest("example",
    private_key_pem=(lambda path: open(path).read())("private_key.pem"),
    subject=tls.CertRequestSubjectArgs(
        common_name="example.com",
        organization="ACME Examples, Inc",
    ))
import * as pulumi from "@pulumi/pulumi";
import * as fs from "fs";
import * as tls from "@pulumi/tls";

const example = new tls.CertRequest("example", {
    privateKeyPem: fs.readFileSync("private_key.pem"),
    subject: {
        commonName: "example.com",
        organization: "ACME Examples, Inc",
    },
});
resources:
  example:
    type: tls:CertRequest
    properties:
      privateKeyPem:
        fn::readFile: private_key.pem
      subject:
        commonName: example.com
        organization: ACME Examples, Inc

Create CertRequest Resource

new CertRequest(name: string, args: CertRequestArgs, opts?: CustomResourceOptions);
@overload
def CertRequest(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                dns_names: Optional[Sequence[str]] = None,
                ip_addresses: Optional[Sequence[str]] = None,
                key_algorithm: Optional[str] = None,
                private_key_pem: Optional[str] = None,
                subject: Optional[CertRequestSubjectArgs] = None,
                uris: Optional[Sequence[str]] = None)
@overload
def CertRequest(resource_name: str,
                args: CertRequestArgs,
                opts: Optional[ResourceOptions] = None)
func NewCertRequest(ctx *Context, name string, args CertRequestArgs, opts ...ResourceOption) (*CertRequest, error)
public CertRequest(string name, CertRequestArgs args, CustomResourceOptions? opts = null)
public CertRequest(String name, CertRequestArgs args)
public CertRequest(String name, CertRequestArgs args, CustomResourceOptions options)
type: tls:CertRequest
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args CertRequestArgs
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 CertRequestArgs
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 CertRequestArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args CertRequestArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args CertRequestArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

CertRequest 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 CertRequest resource accepts the following input properties:

PrivateKeyPem string

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

DnsNames List<string>

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

IpAddresses List<string>

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

KeyAlgorithm string

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

Subject CertRequestSubjectArgs

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

Uris List<string>

List of URIs for which a certificate is being requested (i.e. certificate subjects).

PrivateKeyPem string

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

DnsNames []string

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

IpAddresses []string

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

KeyAlgorithm string

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

Subject CertRequestSubjectArgs

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

Uris []string

List of URIs for which a certificate is being requested (i.e. certificate subjects).

privateKeyPem String

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

dnsNames List<String>

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

ipAddresses List<String>

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

keyAlgorithm String

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

subject CertRequestSubjectArgs

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

uris List<String>

List of URIs for which a certificate is being requested (i.e. certificate subjects).

privateKeyPem string

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

dnsNames string[]

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

ipAddresses string[]

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

keyAlgorithm string

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

subject CertRequestSubjectArgs

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

uris string[]

List of URIs for which a certificate is being requested (i.e. certificate subjects).

private_key_pem str

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

dns_names Sequence[str]

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

ip_addresses Sequence[str]

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

key_algorithm str

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

subject CertRequestSubjectArgs

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

uris Sequence[str]

List of URIs for which a certificate is being requested (i.e. certificate subjects).

privateKeyPem String

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

dnsNames List<String>

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

ipAddresses List<String>

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

keyAlgorithm String

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

subject Property Map

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

uris List<String>

List of URIs for which a certificate is being requested (i.e. certificate subjects).

Outputs

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

CertRequestPem string

The certificate request 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.

CertRequestPem string

The certificate request 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.

certRequestPem String

The certificate request 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.

certRequestPem string

The certificate request 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.

cert_request_pem str

The certificate request 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 str

The provider-assigned unique ID for this managed resource.

certRequestPem String

The certificate request 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.

Look up Existing CertRequest Resource

Get an existing CertRequest 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?: CertRequestState, opts?: CustomResourceOptions): CertRequest
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cert_request_pem: Optional[str] = None,
        dns_names: Optional[Sequence[str]] = None,
        ip_addresses: Optional[Sequence[str]] = None,
        key_algorithm: Optional[str] = None,
        private_key_pem: Optional[str] = None,
        subject: Optional[CertRequestSubjectArgs] = None,
        uris: Optional[Sequence[str]] = None) -> CertRequest
func GetCertRequest(ctx *Context, name string, id IDInput, state *CertRequestState, opts ...ResourceOption) (*CertRequest, error)
public static CertRequest Get(string name, Input<string> id, CertRequestState? state, CustomResourceOptions? opts = null)
public static CertRequest get(String name, Output<String> id, CertRequestState 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.
The following state arguments are supported:
CertRequestPem string

The certificate request 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().

DnsNames List<string>

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

IpAddresses List<string>

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

KeyAlgorithm string

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

PrivateKeyPem string

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

Subject CertRequestSubjectArgs

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

Uris List<string>

List of URIs for which a certificate is being requested (i.e. certificate subjects).

CertRequestPem string

The certificate request 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().

DnsNames []string

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

IpAddresses []string

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

KeyAlgorithm string

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

PrivateKeyPem string

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

Subject CertRequestSubjectArgs

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

Uris []string

List of URIs for which a certificate is being requested (i.e. certificate subjects).

certRequestPem String

The certificate request 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().

dnsNames List<String>

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

ipAddresses List<String>

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

keyAlgorithm String

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

privateKeyPem String

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

subject CertRequestSubjectArgs

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

uris List<String>

List of URIs for which a certificate is being requested (i.e. certificate subjects).

certRequestPem string

The certificate request 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().

dnsNames string[]

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

ipAddresses string[]

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

keyAlgorithm string

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

privateKeyPem string

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

subject CertRequestSubjectArgs

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

uris string[]

List of URIs for which a certificate is being requested (i.e. certificate subjects).

cert_request_pem str

The certificate request 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().

dns_names Sequence[str]

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

ip_addresses Sequence[str]

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

key_algorithm str

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

private_key_pem str

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

subject CertRequestSubjectArgs

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

uris Sequence[str]

List of URIs for which a certificate is being requested (i.e. certificate subjects).

certRequestPem String

The certificate request 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().

dnsNames List<String>

List of DNS names for which a certificate is being requested (i.e. certificate subjects).

ipAddresses List<String>

List of IP addresses for which a certificate is being requested (i.e. certificate subjects).

keyAlgorithm String

Name of the algorithm used when generating the private key provided in private_key_pem. NOTE: this is deprecated and ignored, as the key algorithm is now inferred from the key.

Deprecated:

This is now ignored, as the key algorithm is inferred from the private_key_pem.

privateKeyPem String

Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the file interpolation function. Only an irreversible secure hash of the private key will be stored in the Terraform state.

subject Property Map

The subject for which a certificate is being requested. The acceptable arguments are all optional and their naming is based upon Issuer Distinguished Names (RFC5280) section.

uris List<String>

List of URIs for which a certificate is being requested (i.e. certificate subjects).

Supporting Types

CertRequestSubject

CommonName string

Distinguished name: CN

Country string

Distinguished name: C

Locality string

Distinguished name: L

Organization string

Distinguished name: O

OrganizationalUnit string

Distinguished name: OU

PostalCode string

Distinguished name: PC

Province string

Distinguished name: ST

SerialNumber string

Distinguished name: SERIALNUMBER

StreetAddresses List<string>

Distinguished name: STREET

CommonName string

Distinguished name: CN

Country string

Distinguished name: C

Locality string

Distinguished name: L

Organization string

Distinguished name: O

OrganizationalUnit string

Distinguished name: OU

PostalCode string

Distinguished name: PC

Province string

Distinguished name: ST

SerialNumber string

Distinguished name: SERIALNUMBER

StreetAddresses []string

Distinguished name: STREET

commonName String

Distinguished name: CN

country String

Distinguished name: C

locality String

Distinguished name: L

organization String

Distinguished name: O

organizationalUnit String

Distinguished name: OU

postalCode String

Distinguished name: PC

province String

Distinguished name: ST

serialNumber String

Distinguished name: SERIALNUMBER

streetAddresses List<String>

Distinguished name: STREET

commonName string

Distinguished name: CN

country string

Distinguished name: C

locality string

Distinguished name: L

organization string

Distinguished name: O

organizationalUnit string

Distinguished name: OU

postalCode string

Distinguished name: PC

province string

Distinguished name: ST

serialNumber string

Distinguished name: SERIALNUMBER

streetAddresses string[]

Distinguished name: STREET

common_name str

Distinguished name: CN

country str

Distinguished name: C

locality str

Distinguished name: L

organization str

Distinguished name: O

organizational_unit str

Distinguished name: OU

postal_code str

Distinguished name: PC

province str

Distinguished name: ST

serial_number str

Distinguished name: SERIALNUMBER

street_addresses Sequence[str]

Distinguished name: STREET

commonName String

Distinguished name: CN

country String

Distinguished name: C

locality String

Distinguished name: L

organization String

Distinguished name: O

organizationalUnit String

Distinguished name: OU

postalCode String

Distinguished name: PC

province String

Distinguished name: ST

serialNumber String

Distinguished name: SERIALNUMBER

streetAddresses List<String>

Distinguished name: STREET

Package Details

Repository
TLS pulumi/pulumi-tls
License
Apache-2.0
Notes

This Pulumi package is based on the tls Terraform Provider.