LoadBalancerArgs

data class LoadBalancerArgs(val algorithm: Output<Either<String, Algorithm>>? = null, val disableLetsEncryptDnsRecords: Output<Boolean>? = null, val domains: Output<List<LoadBalancerDomainArgs>>? = null, val dropletIds: Output<List<Int>>? = null, val dropletTag: Output<String>? = null, val enableBackendKeepalive: Output<Boolean>? = null, val enableProxyProtocol: Output<Boolean>? = null, val firewall: Output<LoadBalancerFirewallArgs>? = null, val forwardingRules: Output<List<LoadBalancerForwardingRuleArgs>>? = null, val glbSettings: Output<LoadBalancerGlbSettingsArgs>? = null, val healthcheck: Output<LoadBalancerHealthcheckArgs>? = null, val httpIdleTimeoutSeconds: Output<Int>? = null, val name: Output<String>? = null, val network: Output<String>? = null, val networkStack: Output<String>? = null, val projectId: Output<String>? = null, val redirectHttpToHttps: Output<Boolean>? = null, val region: Output<Either<String, Region>>? = null, val size: Output<String>? = null, val sizeUnit: Output<Int>? = null, val stickySessions: Output<LoadBalancerStickySessionsArgs>? = null, val targetLoadBalancerIds: Output<List<String>>? = null, val tlsCipherPolicy: Output<String>? = null, val type: Output<String>? = null, val vpcUuid: Output<String>? = null) : ConvertibleToJava<LoadBalancerArgs>

Provides a DigitalOcean Load Balancer resource. This can be used to create, modify, and delete Load Balancers.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const web = new digitalocean.Droplet("web", {
name: "web-1",
size: digitalocean.DropletSlug.DropletS1VCPU1GB,
image: "ubuntu-18-04-x64",
region: digitalocean.Region.NYC3,
});
const _public = new digitalocean.LoadBalancer("public", {
name: "loadbalancer-1",
region: digitalocean.Region.NYC3,
forwardingRules: [{
entryPort: 80,
entryProtocol: "http",
targetPort: 80,
targetProtocol: "http",
}],
healthcheck: {
port: 22,
protocol: "tcp",
},
dropletIds: [web&#46;id],
});
import pulumi
import pulumi_digitalocean as digitalocean
web = digitalocean.Droplet("web",
name="web-1",
size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
image="ubuntu-18-04-x64",
region=digitalocean.Region.NYC3)
public = digitalocean.LoadBalancer("public",
name="loadbalancer-1",
region=digitalocean.Region.NYC3,
forwarding_rules=[{
"entry_port": 80,
"entry_protocol": "http",
"target_port": 80,
"target_protocol": "http",
}],
healthcheck={
"port": 22,
"protocol": "tcp",
},
droplet_ids=[web&#46;id])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var web = new DigitalOcean.Droplet("web", new()
{
Name = "web-1",
Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
Image = "ubuntu-18-04-x64",
Region = DigitalOcean.Region.NYC3,
});
var @public = new DigitalOcean.LoadBalancer("public", new()
{
Name = "loadbalancer-1",
Region = DigitalOcean.Region.NYC3,
ForwardingRules = new[]
{
new DigitalOcean.Inputs.LoadBalancerForwardingRuleArgs
{
EntryPort = 80,
EntryProtocol = "http",
TargetPort = 80,
TargetProtocol = "http",
},
},
Healthcheck = new DigitalOcean.Inputs.LoadBalancerHealthcheckArgs
{
Port = 22,
Protocol = "tcp",
},
DropletIds = new[]
{
web.Id,
},
});
});
package main
import (
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
web, err := digitalocean.NewDroplet(ctx, "web", &digitalocean.DropletArgs{
Name: pulumi.String("web-1"),
Size: pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
Image: pulumi.String("ubuntu-18-04-x64"),
Region: pulumi.String(digitalocean.RegionNYC3),
})
if err != nil {
return err
}
_, err = digitalocean.NewLoadBalancer(ctx, "public", &digitalocean.LoadBalancerArgs{
Name: pulumi.String("loadbalancer-1"),
Region: pulumi.String(digitalocean.RegionNYC3),
ForwardingRules: digitalocean.LoadBalancerForwardingRuleArray{
&digitalocean.LoadBalancerForwardingRuleArgs{
EntryPort: pulumi.Int(80),
EntryProtocol: pulumi.String("http"),
TargetPort: pulumi.Int(80),
TargetProtocol: pulumi.String("http"),
},
},
Healthcheck: &digitalocean.LoadBalancerHealthcheckArgs{
Port: pulumi.Int(22),
Protocol: pulumi.String("tcp"),
},
DropletIds: pulumi.IntArray{
web.ID(),
},
})
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.digitalocean.Droplet;
import com.pulumi.digitalocean.DropletArgs;
import com.pulumi.digitalocean.LoadBalancer;
import com.pulumi.digitalocean.LoadBalancerArgs;
import com.pulumi.digitalocean.inputs.LoadBalancerForwardingRuleArgs;
import com.pulumi.digitalocean.inputs.LoadBalancerHealthcheckArgs;
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 web = new Droplet("web", DropletArgs.builder()
.name("web-1")
.size("s-1vcpu-1gb")
.image("ubuntu-18-04-x64")
.region("nyc3")
.build());
var public_ = new LoadBalancer("public", LoadBalancerArgs.builder()
.name("loadbalancer-1")
.region("nyc3")
.forwardingRules(LoadBalancerForwardingRuleArgs.builder()
.entryPort(80)
.entryProtocol("http")
.targetPort(80)
.targetProtocol("http")
.build())
.healthcheck(LoadBalancerHealthcheckArgs.builder()
.port(22)
.protocol("tcp")
.build())
.dropletIds(web.id())
.build());
}
}
resources:
web:
type: digitalocean:Droplet
properties:
name: web-1
size: s-1vcpu-1gb
image: ubuntu-18-04-x64
region: nyc3
public:
type: digitalocean:LoadBalancer
properties:
name: loadbalancer-1
region: nyc3
forwardingRules:
- entryPort: 80
entryProtocol: http
targetPort: 80
targetProtocol: http
healthcheck:
port: 22
protocol: tcp
dropletIds:
- ${web.id}

When managing certificates attached to the load balancer, make sure to add the create_before_destroy lifecycle property in order to ensure the certificate is correctly updated when changed. The order of operations will then be: Create new certificate Update loadbalancer with new certificate ->Delete old certificate. When doing so, you must also change the name of the certificate, as there cannot be multiple certificates with the same name in an account.

Import

Load Balancers can be imported using the id, e.g.

$ pulumi import digitalocean:index/loadBalancer:LoadBalancer myloadbalancer 4de7ac8b-495b-4884-9a69-1050c6793cd6

Constructors

Link copied to clipboard
constructor(algorithm: Output<Either<String, Algorithm>>? = null, disableLetsEncryptDnsRecords: Output<Boolean>? = null, domains: Output<List<LoadBalancerDomainArgs>>? = null, dropletIds: Output<List<Int>>? = null, dropletTag: Output<String>? = null, enableBackendKeepalive: Output<Boolean>? = null, enableProxyProtocol: Output<Boolean>? = null, firewall: Output<LoadBalancerFirewallArgs>? = null, forwardingRules: Output<List<LoadBalancerForwardingRuleArgs>>? = null, glbSettings: Output<LoadBalancerGlbSettingsArgs>? = null, healthcheck: Output<LoadBalancerHealthcheckArgs>? = null, httpIdleTimeoutSeconds: Output<Int>? = null, name: Output<String>? = null, network: Output<String>? = null, networkStack: Output<String>? = null, projectId: Output<String>? = null, redirectHttpToHttps: Output<Boolean>? = null, region: Output<Either<String, Region>>? = null, size: Output<String>? = null, sizeUnit: Output<Int>? = null, stickySessions: Output<LoadBalancerStickySessionsArgs>? = null, targetLoadBalancerIds: Output<List<String>>? = null, tlsCipherPolicy: Output<String>? = null, type: Output<String>? = null, vpcUuid: Output<String>? = null)

Properties

Link copied to clipboard
val algorithm: Output<Either<String, Algorithm>>? = null

Deprecated This field has been deprecated. You can no longer specify an algorithm for load balancers. or least_connections. The default value is round_robin.

Link copied to clipboard

A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer. Default value is false.

Link copied to clipboard
val domains: Output<List<LoadBalancerDomainArgs>>? = null

A list of domains required to ingress traffic to a Global Load Balancer. The domains block is documented below.

Link copied to clipboard
val dropletIds: Output<List<Int>>? = null

A list of the IDs of each droplet to be attached to the Load Balancer.

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

The name of a Droplet tag corresponding to Droplets to be assigned to the Load Balancer.

Link copied to clipboard
val enableBackendKeepalive: Output<Boolean>? = null

A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. Default value is false.

Link copied to clipboard
val enableProxyProtocol: Output<Boolean>? = null

A boolean value indicating whether PROXY Protocol should be used to pass information from connecting client requests to the backend service. Default value is false.

Link copied to clipboard
val firewall: Output<LoadBalancerFirewallArgs>? = null

A block containing rules for allowing/denying traffic to the Load Balancer. The firewall block is documented below. Only 1 firewall is allowed.

Link copied to clipboard

A list of forwarding_rule to be assigned to the Load Balancer. The forwarding_rule block is documented below.

Link copied to clipboard

A block containing glb_settings required to define target rules for a Global Load Balancer. The glb_settings block is documented below.

Link copied to clipboard

A healthcheck block to be assigned to the Load Balancer. The healthcheck block is documented below. Only 1 healthcheck is allowed.

Link copied to clipboard
val httpIdleTimeoutSeconds: Output<Int>? = null

Specifies the idle timeout for HTTPS connections on the load balancer in seconds.

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

The Load Balancer name

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

The type of network the Load Balancer is accessible from. It must be either of INTERNAL or EXTERNAL. Defaults to EXTERNAL.

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

The network stack determines the allocation of ipv4/ipv6 addresses to the load balancer. It must be either of IPV4 or DUALSTACK. Defaults to IPV4.

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

The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project.

Link copied to clipboard
val redirectHttpToHttps: Output<Boolean>? = null

A boolean value indicating whether HTTP requests to the Load Balancer on port 80 will be redirected to HTTPS on port 443. Default value is false.

Link copied to clipboard
val region: Output<Either<String, Region>>? = null

The region to start in

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

The size of the Load Balancer. It must be either lb-small, lb-medium, or lb-large. Defaults to lb-small. Only one of size or size_unit may be provided.

Link copied to clipboard
val sizeUnit: Output<Int>? = null

The size of the Load Balancer. It must be in the range (1, 200). Defaults to 1. Only one of size or size_unit may be provided.

Link copied to clipboard

A sticky_sessions block to be assigned to the Load Balancer. The sticky_sessions block is documented below. Only 1 sticky_sessions block is allowed.

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

A list of Load Balancer IDs to be attached behind a Global Load Balancer.

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

The tls cipher policy controls the cipher suites to be used by the load balancer. It must be either of DEFAULT or STRONG. Defaults to DEFAULT.

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

The type of the Load Balancer. It must be either of REGIONAL, REGIONAL_NETWORK, or GLOBAL. Defaults to REGIONAL.

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

The ID of the VPC where the load balancer will be located.

Functions

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