Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

LoadBalancerService

Define services for Hetzner Cloud Load Balancers.

Example Usage

using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var loadBalancer = new HCloud.LoadBalancer("loadBalancer", new HCloud.LoadBalancerArgs
        {
            LoadBalancerType = "lb11",
            Location = "nbg1",
        });
        var loadBalancerService = new HCloud.LoadBalancerService("loadBalancerService", new HCloud.LoadBalancerServiceArgs
        {
            LoadBalancerId = hcloud_load_balancer.Test_load_balancer.Id,
            Protocol = "http",
        });
    }

}
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 {
        _, err := hcloud.NewLoadBalancer(ctx, "loadBalancer", &hcloud.LoadBalancerArgs{
            LoadBalancerType: pulumi.String("lb11"),
            Location:         pulumi.String("nbg1"),
        })
        if err != nil {
            return err
        }
        _, err = hcloud.NewLoadBalancerService(ctx, "loadBalancerService", &hcloud.LoadBalancerServiceArgs{
            LoadBalancerId: pulumi.Any(hcloud_load_balancer.Test_load_balancer.Id),
            Protocol:       pulumi.String("http"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_hcloud as hcloud

load_balancer = hcloud.LoadBalancer("loadBalancer",
    load_balancer_type="lb11",
    location="nbg1")
load_balancer_service = hcloud.LoadBalancerService("loadBalancerService",
    load_balancer_id=hcloud_load_balancer["test_load_balancer"]["id"],
    protocol="http")
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const loadBalancer = new hcloud.LoadBalancer("loadBalancer", {
    loadBalancerType: "lb11",
    location: "nbg1",
});
const loadBalancerService = new hcloud.LoadBalancerService("loadBalancerService", {
    loadBalancerId: hcloud_load_balancer.test_load_balancer.id,
    protocol: "http",
});

Create a LoadBalancerService Resource

new LoadBalancerService(name: string, args: LoadBalancerServiceArgs, opts?: CustomResourceOptions);
def LoadBalancerService(resource_name: str, opts: Optional[ResourceOptions] = None, destination_port: Optional[int] = None, health_check: Optional[LoadBalancerServiceHealthCheckArgs] = None, http: Optional[LoadBalancerServiceHttpArgs] = None, listen_port: Optional[int] = None, load_balancer_id: Optional[str] = None, protocol: Optional[str] = None, proxyprotocol: Optional[bool] = None)
func NewLoadBalancerService(ctx *Context, name string, args LoadBalancerServiceArgs, opts ...ResourceOption) (*LoadBalancerService, error)
public LoadBalancerService(string name, LoadBalancerServiceArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args LoadBalancerServiceArgs
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 LoadBalancerServiceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args LoadBalancerServiceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

LoadBalancerService Resource Properties

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

Inputs

The LoadBalancerService resource accepts the following input properties:

LoadBalancerId string

Id of the load balancer this service belongs to.

Protocol string

Protocol of the service. http, https or tcp

DestinationPort int

Port the service connects to the targets on, required if protocol is tcp. Can be everything between 1 and 65535.

HealthCheck Pulumi.HCloud.Inputs.LoadBalancerServiceHealthCheckArgs

List of health check configurations when protocol is http or https.

Http Pulumi.HCloud.Inputs.LoadBalancerServiceHttpArgs

List of http configurations when protocol is http or https.

ListenPort int

Port the service listen on, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

Proxyprotocol bool

Enable proxyprotocol.

LoadBalancerId string

Id of the load balancer this service belongs to.

Protocol string

Protocol of the service. http, https or tcp

DestinationPort int

Port the service connects to the targets on, required if protocol is tcp. Can be everything between 1 and 65535.

HealthCheck LoadBalancerServiceHealthCheck

List of health check configurations when protocol is http or https.

Http LoadBalancerServiceHttp

List of http configurations when protocol is http or https.

ListenPort int

Port the service listen on, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

Proxyprotocol bool

Enable proxyprotocol.

loadBalancerId string

Id of the load balancer this service belongs to.

protocol string

Protocol of the service. http, https or tcp

destinationPort number

Port the service connects to the targets on, required if protocol is tcp. Can be everything between 1 and 65535.

healthCheck LoadBalancerServiceHealthCheck

List of health check configurations when protocol is http or https.

http LoadBalancerServiceHttp

List of http configurations when protocol is http or https.

listenPort number

Port the service listen on, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

proxyprotocol boolean

Enable proxyprotocol.

load_balancer_id str

Id of the load balancer this service belongs to.

protocol str

Protocol of the service. http, https or tcp

destination_port int

Port the service connects to the targets on, required if protocol is tcp. Can be everything between 1 and 65535.

health_check LoadBalancerServiceHealthCheckArgs

List of health check configurations when protocol is http or https.

http LoadBalancerServiceHttpArgs

List of http configurations when protocol is http or https.

listen_port int

Port the service listen on, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

proxyprotocol bool

Enable proxyprotocol.

Outputs

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

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

Look up an Existing LoadBalancerService Resource

Get an existing LoadBalancerService 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?: LoadBalancerServiceState, opts?: CustomResourceOptions): LoadBalancerService
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, destination_port: Optional[int] = None, health_check: Optional[LoadBalancerServiceHealthCheckArgs] = None, http: Optional[LoadBalancerServiceHttpArgs] = None, listen_port: Optional[int] = None, load_balancer_id: Optional[str] = None, protocol: Optional[str] = None, proxyprotocol: Optional[bool] = None) -> LoadBalancerService
func GetLoadBalancerService(ctx *Context, name string, id IDInput, state *LoadBalancerServiceState, opts ...ResourceOption) (*LoadBalancerService, error)
public static LoadBalancerService Get(string name, Input<string> id, LoadBalancerServiceState? 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:

DestinationPort int

Port the service connects to the targets on, required if protocol is tcp. Can be everything between 1 and 65535.

HealthCheck Pulumi.HCloud.Inputs.LoadBalancerServiceHealthCheckArgs

List of health check configurations when protocol is http or https.

Http Pulumi.HCloud.Inputs.LoadBalancerServiceHttpArgs

List of http configurations when protocol is http or https.

ListenPort int

Port the service listen on, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

LoadBalancerId string

Id of the load balancer this service belongs to.

Protocol string

Protocol of the service. http, https or tcp

Proxyprotocol bool

Enable proxyprotocol.

DestinationPort int

Port the service connects to the targets on, required if protocol is tcp. Can be everything between 1 and 65535.

HealthCheck LoadBalancerServiceHealthCheck

List of health check configurations when protocol is http or https.

Http LoadBalancerServiceHttp

List of http configurations when protocol is http or https.

ListenPort int

Port the service listen on, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

LoadBalancerId string

Id of the load balancer this service belongs to.

Protocol string

Protocol of the service. http, https or tcp

Proxyprotocol bool

Enable proxyprotocol.

destinationPort number

Port the service connects to the targets on, required if protocol is tcp. Can be everything between 1 and 65535.

healthCheck LoadBalancerServiceHealthCheck

List of health check configurations when protocol is http or https.

http LoadBalancerServiceHttp

List of http configurations when protocol is http or https.

listenPort number

Port the service listen on, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

loadBalancerId string

Id of the load balancer this service belongs to.

protocol string

Protocol of the service. http, https or tcp

proxyprotocol boolean

Enable proxyprotocol.

destination_port int

Port the service connects to the targets on, required if protocol is tcp. Can be everything between 1 and 65535.

health_check LoadBalancerServiceHealthCheckArgs

List of health check configurations when protocol is http or https.

http LoadBalancerServiceHttpArgs

List of http configurations when protocol is http or https.

listen_port int

Port the service listen on, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

load_balancer_id str

Id of the load balancer this service belongs to.

protocol str

Protocol of the service. http, https or tcp

proxyprotocol bool

Enable proxyprotocol.

Supporting Types

LoadBalancerServiceHealthCheck

Interval int

Interval how often the health check will be performed, in seconds.

Port int

Port the health check tries to connect to, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

Protocol string

Protocol the health check uses. http or tcp

Timeout int

Timeout when a health check try will be canceled if there is no response, in seconds.

Http Pulumi.HCloud.Inputs.LoadBalancerServiceHealthCheckHttpArgs

List of http configurations. Required if protocol is http.

Retries int

Number of tries a health check will be performed until a target will be listed as unhealthy.

Interval int

Interval how often the health check will be performed, in seconds.

Port int

Port the health check tries to connect to, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

Protocol string

Protocol the health check uses. http or tcp

Timeout int

Timeout when a health check try will be canceled if there is no response, in seconds.

Http LoadBalancerServiceHealthCheckHttp

List of http configurations. Required if protocol is http.

Retries int

Number of tries a health check will be performed until a target will be listed as unhealthy.

interval number

Interval how often the health check will be performed, in seconds.

port number

Port the health check tries to connect to, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

protocol string

Protocol the health check uses. http or tcp

timeout number

Timeout when a health check try will be canceled if there is no response, in seconds.

http LoadBalancerServiceHealthCheckHttp

List of http configurations. Required if protocol is http.

retries number

Number of tries a health check will be performed until a target will be listed as unhealthy.

interval int

Interval how often the health check will be performed, in seconds.

port int

Port the health check tries to connect to, required if protocol is tcp. Can be everything between 1 and 65535. Must be unique per Load Balancer.

protocol str

Protocol the health check uses. http or tcp

timeout int

Timeout when a health check try will be canceled if there is no response, in seconds.

http LoadBalancerServiceHealthCheckHttpArgs

List of http configurations. Required if protocol is http.

retries int

Number of tries a health check will be performed until a target will be listed as unhealthy.

LoadBalancerServiceHealthCheckHttp

Domain string

Domain we try to access when performing the Health Check.

Path string

Path we try to access when performing the Health Check.

Response string

Response we expect to be included in the Target response when a Health Check was performed.

StatusCodes List<string>

We expect that the target answers with these status codes. If not the target is marked as unhealthy.

Tls bool

Enable TLS certificate checking.

Domain string

Domain we try to access when performing the Health Check.

Path string

Path we try to access when performing the Health Check.

Response string

Response we expect to be included in the Target response when a Health Check was performed.

StatusCodes []string

We expect that the target answers with these status codes. If not the target is marked as unhealthy.

Tls bool

Enable TLS certificate checking.

domain string

Domain we try to access when performing the Health Check.

path string

Path we try to access when performing the Health Check.

response string

Response we expect to be included in the Target response when a Health Check was performed.

statusCodes string[]

We expect that the target answers with these status codes. If not the target is marked as unhealthy.

tls boolean

Enable TLS certificate checking.

domain str

Domain we try to access when performing the Health Check.

path str

Path we try to access when performing the Health Check.

response str

Response we expect to be included in the Target response when a Health Check was performed.

status_codes Sequence[str]

We expect that the target answers with these status codes. If not the target is marked as unhealthy.

tls bool

Enable TLS certificate checking.

LoadBalancerServiceHttp

Certificates List<int>

List of IDs from certificates which the Load Balancer has.

CookieLifetime int

Lifetime of the cookie for sticky session (in seconds). Default: 300

CookieName string

Name of the cookie for sticky session. Default: HCLBSTICKY

RedirectHttp bool

Redirect HTTP to HTTPS traffic. Only supported for services with protocol https using the default HTTP port 80.

StickySessions bool

Enable sticky sessions

Certificates []int

List of IDs from certificates which the Load Balancer has.

CookieLifetime int

Lifetime of the cookie for sticky session (in seconds). Default: 300

CookieName string

Name of the cookie for sticky session. Default: HCLBSTICKY

RedirectHttp bool

Redirect HTTP to HTTPS traffic. Only supported for services with protocol https using the default HTTP port 80.

StickySessions bool

Enable sticky sessions

certificates number[]

List of IDs from certificates which the Load Balancer has.

cookieLifetime number

Lifetime of the cookie for sticky session (in seconds). Default: 300

cookieName string

Name of the cookie for sticky session. Default: HCLBSTICKY

redirectHttp boolean

Redirect HTTP to HTTPS traffic. Only supported for services with protocol https using the default HTTP port 80.

stickySessions boolean

Enable sticky sessions

certificates Sequence[int]

List of IDs from certificates which the Load Balancer has.

cookie_lifetime int

Lifetime of the cookie for sticky session (in seconds). Default: 300

cookie_name str

Name of the cookie for sticky session. Default: HCLBSTICKY

redirect_http bool

Redirect HTTP to HTTPS traffic. Only supported for services with protocol https using the default HTTP port 80.

sticky_sessions bool

Enable sticky sessions

Import

Load Balancer Service entries can be imported using a compound ID with the following format<load-balancer-id>__<listen-port>

 $ pulumi import hcloud:index/loadBalancerService:LoadBalancerService myloadbalancernetwork 123__80

Package Details

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