Certificate

class Certificate : KotlinCustomResource

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

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.Certificate;
import com.pulumi.digitalocean.CertificateArgs;
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 cert = new Certificate("cert", CertificateArgs.builder()
.type("custom")
.privateKey(Files.readString(Paths.get("/Users/myuser/certs/privkey.pem")))
.leafCertificate(Files.readString(Paths.get("/Users/myuser/certs/cert.pem")))
.certificateChain(Files.readString(Paths.get("/Users/myuser/certs/fullchain.pem")))
.build());
}
}

Let's Encrypt Certificate

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.Certificate;
import com.pulumi.digitalocean.CertificateArgs;
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 cert = new Certificate("cert", CertificateArgs.builder()
.domains("example.com")
.type("lets_encrypt")
.build());
}
}

Use with Other Resources

Both custom and Let's Encrypt certificates can be used with other resources including the digitalocean.LoadBalancer and digitalocean.Cdn resources.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.Certificate;
import com.pulumi.digitalocean.CertificateArgs;
import com.pulumi.digitalocean.LoadBalancer;
import com.pulumi.digitalocean.LoadBalancerArgs;
import com.pulumi.digitalocean.inputs.LoadBalancerForwardingRuleArgs;
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 cert = new Certificate("cert", CertificateArgs.builder()
.type("lets_encrypt")
.domains("example.com")
.build());
var public_ = new LoadBalancer("public", LoadBalancerArgs.builder()
.region("nyc3")
.dropletTag("backend")
.forwardingRules(LoadBalancerForwardingRuleArgs.builder()
.entryPort(443)
.entryProtocol("https")
.targetPort(80)
.targetProtocol("http")
.certificateName(cert.name())
.build())
.build());
}
}

Import

Certificates can be imported using the certificate name, e.g.

$ pulumi import digitalocean:index/certificate:Certificate mycertificate cert-01

Properties

Link copied to clipboard
val certificateChain: Output<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.

Link copied to clipboard
val domains: Output<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.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val leafCertificate: Output<String>?

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

Link copied to clipboard
val name: Output<String>

The name of the certificate for identification.

Link copied to clipboard
val notAfter: Output<String>

The expiration date of the certificate

Link copied to clipboard
val privateKey: Output<String>?

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

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val sha1Fingerprint: Output<String>

The SHA-1 fingerprint of the certificate

Link copied to clipboard
val state: Output<String>
Link copied to clipboard
val type: Output<String>?

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

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val uuid: Output<String>

The UUID of the certificate