LoadBalancer

Provides a Hetzner Cloud Load Balancer to represent a Load Balancer in the Hetzner Cloud.

Example Usage

using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var myserver = new HCloud.Server("myserver", new HCloud.ServerArgs
        {
            Image = "ubuntu-18.04",
            ServerType = "cx11",
        });
        var loadBalancer = new HCloud.LoadBalancer("loadBalancer", new HCloud.LoadBalancerArgs
        {
            LoadBalancerType = "lb11",
            Location = "nbg1",
            Targets = 
            {
                new HCloud.Inputs.LoadBalancerTargetArgs
                {
                    ServerId = myserver.Id,
                    Type = "server",
                },
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        myserver, err := hcloud.NewServer(ctx, "myserver", &hcloud.ServerArgs{
            Image:      pulumi.String("ubuntu-18.04"),
            ServerType: pulumi.String("cx11"),
        })
        if err != nil {
            return err
        }
        _, err = hcloud.NewLoadBalancer(ctx, "loadBalancer", &hcloud.LoadBalancerArgs{
            LoadBalancerType: pulumi.String("lb11"),
            Location:         pulumi.String("nbg1"),
            Targets: hcloud.LoadBalancerTargetArray{
                &hcloud.LoadBalancerTargetArgs{
                    ServerId: myserver.ID(),
                    Type:     pulumi.String("server"),
                },
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_hcloud as hcloud

myserver = hcloud.Server("myserver",
    image="ubuntu-18.04",
    server_type="cx11")
load_balancer = hcloud.LoadBalancer("loadBalancer",
    load_balancer_type="lb11",
    location="nbg1",
    targets=[{
        "server_id": myserver.id,
        "type": "server",
    }])
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const myserver = new hcloud.Server("myserver", {
    image: "ubuntu-18.04",
    serverType: "cx11",
});
const loadBalancer = new hcloud.LoadBalancer("load_balancer", {
    loadBalancerType: "lb11",
    location: "nbg1",
    targets: [{
        serverId: myserver.id.apply(id => Number.parseFloat(id)),
        type: "server",
    }],
});

Create a LoadBalancer Resource

def LoadBalancer(resource_name, opts=None, algorithm=None, labels=None, load_balancer_type=None, location=None, name=None, network_zone=None, targets=None, __props__=None);
func NewLoadBalancer(ctx *Context, name string, args LoadBalancerArgs, opts ...ResourceOption) (*LoadBalancer, error)
name string
The unique name of the resource.
args LoadBalancerArgs
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 LoadBalancerArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args LoadBalancerArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

LoadBalancer Resource Properties

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

Inputs

The LoadBalancer resource accepts the following input properties:

LoadBalancerType string
Algorithm Pulumi.HCloud.Inputs.LoadBalancerAlgorithmArgs
Labels Dictionary<string, object>
Location string
Name string
NetworkZone string
Targets List<Pulumi.HCloud.Inputs.LoadBalancerTargetArgs>
LoadBalancerType string
Algorithm LoadBalancerAlgorithm
Labels map[string]interface{}
Location string
Name string
NetworkZone string
Targets []LoadBalancerTargetType
loadBalancerType string
algorithm LoadBalancerAlgorithm
labels {[key: string]: any}
location string
name string
networkZone string
targets LoadBalancerTarget[]
load_balancer_type str
algorithm Dict[LoadBalancerAlgorithm]
labels Dict[str, Any]
location str
name str
network_zone str
targets List[LoadBalancerTarget]

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Ipv4 string
Ipv6 string
NetworkId int
NetworkIp string
Id string
The provider-assigned unique ID for this managed resource.
Ipv4 string
Ipv6 string
NetworkId int
NetworkIp string
id string
The provider-assigned unique ID for this managed resource.
ipv4 string
ipv6 string
networkId number
networkIp string
id str
The provider-assigned unique ID for this managed resource.
ipv4 str
ipv6 str
network_id float
network_ip str

Look up an Existing LoadBalancer Resource

Get an existing LoadBalancer 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?: LoadBalancerState, opts?: CustomResourceOptions): LoadBalancer
static get(resource_name, id, opts=None, algorithm=None, ipv4=None, ipv6=None, labels=None, load_balancer_type=None, location=None, name=None, network_id=None, network_ip=None, network_zone=None, targets=None, __props__=None);
func GetLoadBalancer(ctx *Context, name string, id IDInput, state *LoadBalancerState, opts ...ResourceOption) (*LoadBalancer, error)
public static LoadBalancer Get(string name, Input<string> id, LoadBalancerState? 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:

Algorithm Pulumi.HCloud.Inputs.LoadBalancerAlgorithmArgs
Ipv4 string
Ipv6 string
Labels Dictionary<string, object>
LoadBalancerType string
Location string
Name string
NetworkId int
NetworkIp string
NetworkZone string
Targets List<Pulumi.HCloud.Inputs.LoadBalancerTargetArgs>
Algorithm LoadBalancerAlgorithm
Ipv4 string
Ipv6 string
Labels map[string]interface{}
LoadBalancerType string
Location string
Name string
NetworkId int
NetworkIp string
NetworkZone string
Targets []LoadBalancerTargetType
algorithm LoadBalancerAlgorithm
ipv4 string
ipv6 string
labels {[key: string]: any}
loadBalancerType string
location string
name string
networkId number
networkIp string
networkZone string
targets LoadBalancerTarget[]
algorithm Dict[LoadBalancerAlgorithm]
ipv4 str
ipv6 str
labels Dict[str, Any]
load_balancer_type str
location str
name str
network_id float
network_ip str
network_zone str
targets List[LoadBalancerTarget]

Supporting Types

LoadBalancerAlgorithm

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Type string
Type string
type string
type str

LoadBalancerTarget

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Type string
ServerId int
UsePrivateIp bool

Deprecated: Does not work. Use the hcloud_load_balancer_target resource instead.

Type string
ServerId int
UsePrivateIp bool

Deprecated: Does not work. Use the hcloud_load_balancer_target resource instead.

type string
serverId number
usePrivateIp boolean

Deprecated: Does not work. Use the hcloud_load_balancer_target resource instead.

type str
server_id float
use_private_ip bool

Deprecated: Does not work. Use the hcloud_load_balancer_target resource instead.

Package Details

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