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
new LoadBalancer(name: string, args: LoadBalancerArgs, opts?: CustomResourceOptions);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)public LoadBalancer(string name, LoadBalancerArgs args, CustomResourceOptions? opts = null)- 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:
Outputs
All input properties are implicitly available as output properties. Additionally, the LoadBalancer resource produces the following output properties:
- 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): LoadBalancerstatic 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:
Supporting Types
LoadBalancerAlgorithm
LoadBalancerTarget
Package Details
- Repository
- https://github.com/pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcloudTerraform Provider.