Certificate

Provides a DigitalOcean Certificate resource that allows you to manage certificates for configuring TLS termination in Load Balancers. Certificates created with this resource can be referenced in your Load Balancer configuration via their ID. The certificate can either be a custom one provided by you or automatically generated one with Let’s Encrypt.

Example Usage

Custom Certificate

using System.IO;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

class MyStack : Stack
{
    public MyStack()
    {
        var cert = new DigitalOcean.Certificate("cert", new DigitalOcean.CertificateArgs
        {
            Type = "custom",
            PrivateKey = File.ReadAllText("/Users/myuser/certs/privkey.pem"),
            LeafCertificate = File.ReadAllText("/Users/myuser/certs/cert.pem"),
            CertificateChain = File.ReadAllText("/Users/myuser/certs/fullchain.pem"),
        });
    }

}

Coming soon!

import pulumi
import pulumi_digitalocean as digitalocean

cert = digitalocean.Certificate("cert",
    type="custom",
    private_key=(lambda path: open(path).read())("/Users/myuser/certs/privkey.pem"),
    leaf_certificate=(lambda path: open(path).read())("/Users/myuser/certs/cert.pem"),
    certificate_chain=(lambda path: open(path).read())("/Users/myuser/certs/fullchain.pem"))
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
import * from "fs";

const cert = new digitalocean.Certificate("cert", {
    type: "custom",
    privateKey: fs.readFileSync("/Users/myuser/certs/privkey.pem"),
    leafCertificate: fs.readFileSync("/Users/myuser/certs/cert.pem"),
    certificateChain: fs.readFileSync("/Users/myuser/certs/fullchain.pem"),
});

Let's Encrypt Certificate

using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

class MyStack : Stack
{
    public MyStack()
    {
        var cert = new DigitalOcean.Certificate("cert", new DigitalOcean.CertificateArgs
        {
            Domains = 
            {
                "example.com",
            },
            Type = "lets_encrypt",
        });
    }

}

Coming soon!

import pulumi
import pulumi_digitalocean as digitalocean

cert = digitalocean.Certificate("cert",
    domains=["example.com"],
    type="lets_encrypt")
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const cert = new digitalocean.Certificate("cert", {
    domains: ["example.com"],
    type: "lets_encrypt",
});

Create a Certificate Resource

def Certificate(resource_name, opts=None, certificate_chain=None, domains=None, leaf_certificate=None, name=None, private_key=None, type=None, __props__=None);
func NewCertificate(ctx *Context, name string, args *CertificateArgs, opts ...ResourceOption) (*Certificate, error)
public Certificate(string name, CertificateArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args CertificateArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args CertificateArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args CertificateArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Certificate Resource Properties

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

Inputs

The Certificate resource accepts the following input properties:

CertificateChain string

The full PEM-formatted trust chain between the certificate authority’s certificate and your domain’s TLS certificate. Only valid when type is custom.

Domains List<string>

List of fully qualified domain names (FQDNs) for which the certificate will be issued. The domains must be managed using DigitalOcean’s DNS. Only valid when type is lets_encrypt.

LeafCertificate string

The contents of a PEM-formatted public TLS certificate. Only valid when type is custom.

Name string

The name of the certificate for identification.

PrivateKey string

The contents of a PEM-formatted private-key corresponding to the SSL certificate. Only valid when type is custom.

Type string

The type of certificate to provision. Can be either custom or lets_encrypt. Defaults to custom.

CertificateChain string

The full PEM-formatted trust chain between the certificate authority’s certificate and your domain’s TLS certificate. Only valid when type is custom.

Domains []string

List of fully qualified domain names (FQDNs) for which the certificate will be issued. The domains must be managed using DigitalOcean’s DNS. Only valid when type is lets_encrypt.

LeafCertificate string

The contents of a PEM-formatted public TLS certificate. Only valid when type is custom.

Name string

The name of the certificate for identification.

PrivateKey string

The contents of a PEM-formatted private-key corresponding to the SSL certificate. Only valid when type is custom.

Type string

The type of certificate to provision. Can be either custom or lets_encrypt. Defaults to custom.

certificateChain string

The full PEM-formatted trust chain between the certificate authority’s certificate and your domain’s TLS certificate. Only valid when type is custom.

domains string[]

List of fully qualified domain names (FQDNs) for which the certificate will be issued. The domains must be managed using DigitalOcean’s DNS. Only valid when type is lets_encrypt.

leafCertificate string

The contents of a PEM-formatted public TLS certificate. Only valid when type is custom.

name string

The name of the certificate for identification.

privateKey string

The contents of a PEM-formatted private-key corresponding to the SSL certificate. Only valid when type is custom.

type CertificateType

The type of certificate to provision. Can be either custom or lets_encrypt. Defaults to custom.

certificate_chain str

The full PEM-formatted trust chain between the certificate authority’s certificate and your domain’s TLS certificate. Only valid when type is custom.

domains List[str]

List of fully qualified domain names (FQDNs) for which the certificate will be issued. The domains must be managed using DigitalOcean’s DNS. Only valid when type is lets_encrypt.

leaf_certificate str

The contents of a PEM-formatted public TLS certificate. Only valid when type is custom.

name str

The name of the certificate for identification.

private_key str

The contents of a PEM-formatted private-key corresponding to the SSL certificate. Only valid when type is custom.

type str

The type of certificate to provision. Can be either custom or lets_encrypt. Defaults to custom.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
NotAfter string

The expiration date of the certificate

Sha1Fingerprint string

The SHA-1 fingerprint of the certificate

State string
Id string
The provider-assigned unique ID for this managed resource.
NotAfter string

The expiration date of the certificate

Sha1Fingerprint string

The SHA-1 fingerprint of the certificate

State string
id string
The provider-assigned unique ID for this managed resource.
notAfter string

The expiration date of the certificate

sha1Fingerprint string

The SHA-1 fingerprint of the certificate

state string
id str
The provider-assigned unique ID for this managed resource.
not_after str

The expiration date of the certificate

sha1_fingerprint str

The SHA-1 fingerprint of the certificate

state str

Look up an Existing Certificate Resource

Get an existing Certificate 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?: CertificateState, opts?: CustomResourceOptions): Certificate
static get(resource_name, id, opts=None, certificate_chain=None, domains=None, leaf_certificate=None, name=None, not_after=None, private_key=None, sha1_fingerprint=None, state=None, type=None, __props__=None);
func GetCertificate(ctx *Context, name string, id IDInput, state *CertificateState, opts ...ResourceOption) (*Certificate, error)
public static Certificate Get(string name, Input<string> id, CertificateState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

CertificateChain string

The full PEM-formatted trust chain between the certificate authority’s certificate and your domain’s TLS certificate. Only valid when type is custom.

Domains List<string>

List of fully qualified domain names (FQDNs) for which the certificate will be issued. The domains must be managed using DigitalOcean’s DNS. Only valid when type is lets_encrypt.

LeafCertificate string

The contents of a PEM-formatted public TLS certificate. Only valid when type is custom.

Name string

The name of the certificate for identification.

NotAfter string

The expiration date of the certificate

PrivateKey string

The contents of a PEM-formatted private-key corresponding to the SSL certificate. Only valid when type is custom.

Sha1Fingerprint string

The SHA-1 fingerprint of the certificate

State string
Type string

The type of certificate to provision. Can be either custom or lets_encrypt. Defaults to custom.

CertificateChain string

The full PEM-formatted trust chain between the certificate authority’s certificate and your domain’s TLS certificate. Only valid when type is custom.

Domains []string

List of fully qualified domain names (FQDNs) for which the certificate will be issued. The domains must be managed using DigitalOcean’s DNS. Only valid when type is lets_encrypt.

LeafCertificate string

The contents of a PEM-formatted public TLS certificate. Only valid when type is custom.

Name string

The name of the certificate for identification.

NotAfter string

The expiration date of the certificate

PrivateKey string

The contents of a PEM-formatted private-key corresponding to the SSL certificate. Only valid when type is custom.

Sha1Fingerprint string

The SHA-1 fingerprint of the certificate

State string
Type string

The type of certificate to provision. Can be either custom or lets_encrypt. Defaults to custom.

certificateChain string

The full PEM-formatted trust chain between the certificate authority’s certificate and your domain’s TLS certificate. Only valid when type is custom.

domains string[]

List of fully qualified domain names (FQDNs) for which the certificate will be issued. The domains must be managed using DigitalOcean’s DNS. Only valid when type is lets_encrypt.

leafCertificate string

The contents of a PEM-formatted public TLS certificate. Only valid when type is custom.

name string

The name of the certificate for identification.

notAfter string

The expiration date of the certificate

privateKey string

The contents of a PEM-formatted private-key corresponding to the SSL certificate. Only valid when type is custom.

sha1Fingerprint string

The SHA-1 fingerprint of the certificate

state string
type CertificateType

The type of certificate to provision. Can be either custom or lets_encrypt. Defaults to custom.

certificate_chain str

The full PEM-formatted trust chain between the certificate authority’s certificate and your domain’s TLS certificate. Only valid when type is custom.

domains List[str]

List of fully qualified domain names (FQDNs) for which the certificate will be issued. The domains must be managed using DigitalOcean’s DNS. Only valid when type is lets_encrypt.

leaf_certificate str

The contents of a PEM-formatted public TLS certificate. Only valid when type is custom.

name str

The name of the certificate for identification.

not_after str

The expiration date of the certificate

private_key str

The contents of a PEM-formatted private-key corresponding to the SSL certificate. Only valid when type is custom.

sha1_fingerprint str

The SHA-1 fingerprint of the certificate

state str
type str

The type of certificate to provision. Can be either custom or lets_encrypt. Defaults to custom.

Package Details

Repository
https://github.com/pulumi/pulumi-digitalocean
License
Apache-2.0
Notes
This Pulumi package is based on the digitalocean Terraform Provider.