LoadBalancerTarget

Adds a target to a Hetzner Cloud Load Balancer.

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",
        });
        var loadBalancerTarget = new HCloud.LoadBalancerTarget("loadBalancerTarget", new HCloud.LoadBalancerTargetArgs
        {
            LoadBalancerId = hcloud_load_balancer.Load_balcancer.Id,
            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"),
        })
        if err != nil {
            return err
        }
        _, err = hcloud.NewLoadBalancerTarget(ctx, "loadBalancerTarget", &hcloud.LoadBalancerTargetArgs{
            LoadBalancerId: pulumi.Any(hcloud_load_balancer.Load_balcancer.Id),
            ServerId:       myServer.ID(),
            Type:           pulumi.String("server"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_hcloud as hcloud

my_server = hcloud.Server("myServer",
    image="ubuntu-18.04",
    server_type="cx11")
load_balancer = hcloud.LoadBalancer("loadBalancer",
    load_balancer_type="lb11",
    location="nbg1")
load_balancer_target = hcloud.LoadBalancerTarget("loadBalancerTarget",
    load_balancer_id=hcloud_load_balancer["load_balcancer"]["id"],
    server_id=my_server.id,
    type="server")
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const myServer = new hcloud.Server("my_server", {
    image: "ubuntu-18.04",
    serverType: "cx11",
});
const loadBalancer = new hcloud.LoadBalancer("load_balancer", {
    loadBalancerType: "lb11",
    location: "nbg1",
});
const loadBalancerTarget = new hcloud.LoadBalancerTarget("load_balancer_target", {
    loadBalancerId: hcloud_load_balancer_load_balcancer.id,
    serverId: myServer.id.apply(id => Number.parseFloat(id)),
    type: "server",
});

Create a LoadBalancerTarget Resource

def LoadBalancerTarget(resource_name, opts=None, load_balancer_id=None, server_id=None, type=None, use_private_ip=None, __props__=None);
name string
The unique name of the resource.
args LoadBalancerTargetArgs
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 LoadBalancerTargetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args LoadBalancerTargetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

LoadBalancerTarget Resource Properties

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

Inputs

The LoadBalancerTarget resource accepts the following input properties:

LoadBalancerId int
Type string
ServerId int
UsePrivateIp bool
LoadBalancerId int
Type string
ServerId int
UsePrivateIp bool
loadBalancerId number
type string
serverId number
usePrivateIp boolean
load_balancer_id float
type str
server_id float
use_private_ip bool

Outputs

All input properties are implicitly available as output properties. Additionally, the LoadBalancerTarget 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 LoadBalancerTarget Resource

Get an existing LoadBalancerTarget 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?: LoadBalancerTargetState, opts?: CustomResourceOptions): LoadBalancerTarget
static get(resource_name, id, opts=None, load_balancer_id=None, server_id=None, type=None, use_private_ip=None, __props__=None);
func GetLoadBalancerTarget(ctx *Context, name string, id IDInput, state *LoadBalancerTargetState, opts ...ResourceOption) (*LoadBalancerTarget, error)
public static LoadBalancerTarget Get(string name, Input<string> id, LoadBalancerTargetState? 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:

LoadBalancerId int
ServerId int
Type string
UsePrivateIp bool
LoadBalancerId int
ServerId int
Type string
UsePrivateIp bool
loadBalancerId number
serverId number
type string
usePrivateIp boolean
load_balancer_id float
server_id float
type str
use_private_ip bool

Package Details

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