CertificateArgs

data class CertificateArgs(val certificateChain: Output<String>? = null, val domains: Output<List<String>>? = null, val leafCertificate: Output<String>? = null, val name: Output<String>? = null, val privateKey: Output<String>? = null, val type: Output<Either<String, CertificateType>>? = null) : ConvertibleToJava<CertificateArgs>

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

Constructors

Link copied to clipboard
fun CertificateArgs(certificateChain: Output<String>? = null, domains: Output<List<String>>? = null, leafCertificate: Output<String>? = null, name: Output<String>? = null, privateKey: Output<String>? = null, type: Output<Either<String, CertificateType>>? = null)

Functions

Link copied to clipboard
open override fun toJava(): CertificateArgs

Properties

Link copied to clipboard
val certificateChain: Output<String>? = null

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>>? = null

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 leafCertificate: Output<String>? = null

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

Link copied to clipboard
val name: Output<String>? = null

The name of the certificate for identification.

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

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

Link copied to clipboard
val type: Output<Either<String, CertificateType>>? = null

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