CertRequest class
Creates a Certificate Signing Request (CSR) in PEM (RFC 1421) format.
PEM is the typical format used to request a certificate from a Certificate Authority (CA).
This resource is intended to be used in conjunction with a Terraform provider for a particular certificate authority in order to provision a new certificate.
This is a logical resource, so it contributes only to the current Terraform state and does not create any external managed resources.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as std from "@pulumi/std";
import * as tls from "@pulumi/tls";
const example = new tls.CertRequest("example", {
privateKeyPem: std.file({
input: "private_key.pem",
}).then(invoke => invoke.result),
subject: {
commonName: "example.com",
organization: "ACME Examples, Inc",
},
});
import pulumi
import pulumi_std as std
import pulumi_tls as tls
example = tls.CertRequest("example",
private_key_pem=std.file(input="private_key.pem").result,
subject={
"common_name": "example.com",
"organization": "ACME Examples, Inc",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Std = Pulumi.Std;
using Tls = Pulumi.Tls;
return await Deployment.RunAsync(() =>
{
var example = new Tls.CertRequest("example", new()
{
PrivateKeyPem = Std.File.Invoke(new()
{
Input = "private_key.pem",
}).Apply(invoke => invoke.Result),
Subject = new Tls.Inputs.CertRequestSubjectArgs
{
CommonName = "example.com",
Organization = "ACME Examples, Inc",
},
});
});
package main
import (
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi-tls/sdk/v5/go/tls"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
invokeFile, err := std.File(ctx, &std.FileArgs{
Input: "private_key.pem",
}, nil)
if err != nil {
return err
}
_, err = tls.NewCertRequest(ctx, "example", &tls.CertRequestArgs{
PrivateKeyPem: pulumi.String(invokeFile.Result),
Subject: &tls.CertRequestSubjectArgs{
CommonName: pulumi.String("example.com"),
Organization: pulumi.String("ACME Examples, Inc"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
std = {
source = "pulumi/std"
}
tls = {
source = "pulumi/tls"
}
}
}
resource "tls_certrequest" "example" {
private_key_pem = file("private_key.pem")
subject = {
common_name = "example.com"
organization = "ACME Examples, Inc"
}
}
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 com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.FileArgs;
import java.util.ArrayList;
import java.util.Arrays;
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(StdFunctions.file(FileArgs.builder()
.input("private_key.pem")
.build()).result())
.subject(CertRequestSubjectArgs.builder()
.commonName("example.com")
.organization("ACME Examples, Inc")
.build())
.build());
}
}
resources:
example:
type: tls:CertRequest
properties:
privateKeyPem:
fn::invoke:
function: std:file
arguments:
input: private_key.pem
return: result
subject:
commonName: example.com
organization: ACME Examples, Inc
Constructors
- CertRequest(String name, {CertRequestArgs? args, CustomResourceOptions? options})
-
Creates a new CertRequest.
nameThe Pulumi resource name.argsArguments used to configure this CertRequest. The set of arguments for CertRequest.optionsResource options controlling this resource's behavior. - CertRequest.reference(String urn)
- Creates a typed reference to an existing CertRequest resource.
Properties
-
certRequestPem
↔ Output<
String> -
The certificate request data in PEM (RFC 1421) format. NOTE: the underlying libraries that generate this value append a
\nat the end of the PEM. In case this disrupts your use case, we recommend usingtrimspace().latefinal -
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
dnsNames
↔ Output<
List< String> ?> -
List of DNS names for which a certificate is being requested (i.e. certificate subjects).
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
-
ipAddresses
↔ Output<
List< String> ?> -
List of IP addresses for which a certificate is being requested (i.e. certificate subjects).
latefinal
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
keyAlgorithm
↔ Output<
String> -
Name of the algorithm used when generating the private key provided in
privateKeyPem.latefinal -
privateKeyPem
↔ Output<
String?> -
Private key in PEM (RFC 1421) format, that the certificate will belong to. This can be read from a separate file using the
fileinterpolation function. Exactly one ofprivateKeyPemorprivateKeyPemWomust be set.latefinal -
privateKeyPemWo
↔ Output<
String?> -
NOTE: This field is write-only and its value will not be updated in state as part of read operations.
Write-only private key in PEM (RFC 1421) format, that the certificate will belong to. Unlike
privateKeyPem, the value provided here is never persisted to Terraform state. RequiresprivateKeyPemWoVersionto be set, and exactly one ofprivateKeyPemorprivateKeyPemWomust be set.latefinal -
privateKeyPemWoVersion
↔ Output<
int?> -
The version of the
privateKeyPemWowrite-only private key. Because the write-only key is not stored in state, this version is the only signal the provider has that the key changed: increment it to force the certificate request to be re-issued when rotating the key.latefinal -
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
subject
↔ Output<
CertRequestSubject?> -
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.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
uris
↔ Output<
List< String> ?> -
List of URIs for which a certificate is being requested (i.e. certificate subjects).
latefinal
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {CertRequestState? state, CustomResourceOptions? options}) → CertRequest -
Gets an existing CertRequest resource's state with the given
nameandid.