hcloud logo
Hetzner Cloud v1.10.3, Mar 8 23

hcloud.LoadBalancerService

Define services for Hetzner Cloud Load Balancers.

Example Usage

using System.Collections.Generic;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    var loadBalancer = new HCloud.LoadBalancer("loadBalancer", new()
    {
        LoadBalancerType = "lb11",
        Location = "nbg1",
    });

    var loadBalancerService = new HCloud.LoadBalancerService("loadBalancerService", new()
    {
        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/v3/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
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.LoadBalancer;
import com.pulumi.hcloud.LoadBalancerArgs;
import com.pulumi.hcloud.LoadBalancerService;
import com.pulumi.hcloud.LoadBalancerServiceArgs;
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 loadBalancer = new LoadBalancer("loadBalancer", LoadBalancerArgs.builder()        
            .loadBalancerType("lb11")
            .location("nbg1")
            .build());

        var loadBalancerService = new LoadBalancerService("loadBalancerService", LoadBalancerServiceArgs.builder()        
            .loadBalancerId(hcloud_load_balancer.test_load_balancer().id())
            .protocol("http")
            .build());

    }
}
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",
});
resources:
  loadBalancer:
    type: hcloud:LoadBalancer
    properties:
      loadBalancerType: lb11
      location: nbg1
  loadBalancerService:
    type: hcloud:LoadBalancerService
    properties:
      loadBalancerId: ${hcloud_load_balancer.test_load_balancer.id}
      protocol: http

Create LoadBalancerService Resource

new LoadBalancerService(name: string, args: LoadBalancerServiceArgs, opts?: CustomResourceOptions);
@overload
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)
@overload
def LoadBalancerService(resource_name: str,
                        args: LoadBalancerServiceArgs,
                        opts: Optional[ResourceOptions] = None)
func NewLoadBalancerService(ctx *Context, name string, args LoadBalancerServiceArgs, opts ...ResourceOption) (*LoadBalancerService, error)
public LoadBalancerService(string name, LoadBalancerServiceArgs args, CustomResourceOptions? opts = null)
public LoadBalancerService(String name, LoadBalancerServiceArgs args)
public LoadBalancerService(String name, LoadBalancerServiceArgs args, CustomResourceOptions options)
type: hcloud:LoadBalancerService
properties: # The arguments to resource properties.
options: # 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.
resource_name str
The unique name of the resource.
args LoadBalancerServiceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control 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.
name String
The unique name of the resource.
args LoadBalancerServiceArgs
The arguments to resource properties.
options 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 Architecture and Concepts 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 LoadBalancerServiceHealthCheckArgs

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

Http 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 Integer

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

healthCheck LoadBalancerServiceHealthCheckArgs

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

http LoadBalancerServiceHttpArgs

List of http configurations when protocol is http or https.

listenPort Integer

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.

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 LoadBalancerServiceHealthCheckArgs

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

http LoadBalancerServiceHttpArgs

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.

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 Property Map

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

http Property Map

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.

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 string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up 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)
public static LoadBalancerService get(String name, Output<String> id, LoadBalancerServiceState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
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.
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 LoadBalancerServiceHealthCheckArgs

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

Http 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 Integer

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

healthCheck LoadBalancerServiceHealthCheckArgs

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

http LoadBalancerServiceHttpArgs

List of http configurations when protocol is http or https.

listenPort Integer

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.

destinationPort number

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

healthCheck LoadBalancerServiceHealthCheckArgs

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

http LoadBalancerServiceHttpArgs

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.

destinationPort Number

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

healthCheck Property Map

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

http Property Map

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.

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.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 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 Integer

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

port Integer

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 Integer

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 Integer

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 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 Property Map

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.

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 List<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 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.

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 Boolean

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 List<Integer>

List of IDs from certificates which the Load Balancer has.

cookieLifetime Integer

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 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

certificates List<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

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
Hetzner Cloud pulumi/pulumi-hcloud
License
Apache-2.0
Notes

This Pulumi package is based on the hcloud Terraform Provider.