hcloud.LoadBalancerNetwork
Explore with Pulumi AI
Provides a Hetzner Cloud Load Balancer Network to represent a private network on a Load Balancer in the Hetzner Cloud.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";
const lb1 = new hcloud.LoadBalancer("lb1", {
name: "lb1",
loadBalancerType: "lb11",
networkZone: "eu-central",
});
const mynet = new hcloud.Network("mynet", {
name: "my-net",
ipRange: "10.0.0.0/8",
});
const foonet = new hcloud.NetworkSubnet("foonet", {
networkId: mynet.id,
type: "cloud",
networkZone: "eu-central",
ipRange: "10.0.1.0/24",
});
const srvnetwork = new hcloud.LoadBalancerNetwork("srvnetwork", {
loadBalancerId: lb1.id,
networkId: mynet.id,
ip: "10.0.1.5",
}, {
dependsOn: [srvnetworkHcloudNetworkSubnet],
});
import pulumi
import pulumi_hcloud as hcloud
lb1 = hcloud.LoadBalancer("lb1",
name="lb1",
load_balancer_type="lb11",
network_zone="eu-central")
mynet = hcloud.Network("mynet",
name="my-net",
ip_range="10.0.0.0/8")
foonet = hcloud.NetworkSubnet("foonet",
network_id=mynet.id,
type="cloud",
network_zone="eu-central",
ip_range="10.0.1.0/24")
srvnetwork = hcloud.LoadBalancerNetwork("srvnetwork",
load_balancer_id=lb1.id,
network_id=mynet.id,
ip="10.0.1.5",
opts=pulumi.ResourceOptions(depends_on=[srvnetwork_hcloud_network_subnet]))
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 {
lb1, err := hcloud.NewLoadBalancer(ctx, "lb1", &hcloud.LoadBalancerArgs{
Name: pulumi.String("lb1"),
LoadBalancerType: pulumi.String("lb11"),
NetworkZone: pulumi.String("eu-central"),
})
if err != nil {
return err
}
mynet, err := hcloud.NewNetwork(ctx, "mynet", &hcloud.NetworkArgs{
Name: pulumi.String("my-net"),
IpRange: pulumi.String("10.0.0.0/8"),
})
if err != nil {
return err
}
_, err = hcloud.NewNetworkSubnet(ctx, "foonet", &hcloud.NetworkSubnetArgs{
NetworkId: mynet.ID(),
Type: pulumi.String("cloud"),
NetworkZone: pulumi.String("eu-central"),
IpRange: pulumi.String("10.0.1.0/24"),
})
if err != nil {
return err
}
_, err = hcloud.NewLoadBalancerNetwork(ctx, "srvnetwork", &hcloud.LoadBalancerNetworkArgs{
LoadBalancerId: lb1.ID(),
NetworkId: mynet.ID(),
Ip: pulumi.String("10.0.1.5"),
}, pulumi.DependsOn([]pulumi.Resource{
srvnetworkHcloudNetworkSubnet,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;
return await Deployment.RunAsync(() =>
{
var lb1 = new HCloud.LoadBalancer("lb1", new()
{
Name = "lb1",
LoadBalancerType = "lb11",
NetworkZone = "eu-central",
});
var mynet = new HCloud.Network("mynet", new()
{
Name = "my-net",
IpRange = "10.0.0.0/8",
});
var foonet = new HCloud.NetworkSubnet("foonet", new()
{
NetworkId = mynet.Id,
Type = "cloud",
NetworkZone = "eu-central",
IpRange = "10.0.1.0/24",
});
var srvnetwork = new HCloud.LoadBalancerNetwork("srvnetwork", new()
{
LoadBalancerId = lb1.Id,
NetworkId = mynet.Id,
Ip = "10.0.1.5",
}, new CustomResourceOptions
{
DependsOn =
{
srvnetworkHcloudNetworkSubnet,
},
});
});
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.Network;
import com.pulumi.hcloud.NetworkArgs;
import com.pulumi.hcloud.NetworkSubnet;
import com.pulumi.hcloud.NetworkSubnetArgs;
import com.pulumi.hcloud.LoadBalancerNetwork;
import com.pulumi.hcloud.LoadBalancerNetworkArgs;
import com.pulumi.resources.CustomResourceOptions;
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 lb1 = new LoadBalancer("lb1", LoadBalancerArgs.builder()
.name("lb1")
.loadBalancerType("lb11")
.networkZone("eu-central")
.build());
var mynet = new Network("mynet", NetworkArgs.builder()
.name("my-net")
.ipRange("10.0.0.0/8")
.build());
var foonet = new NetworkSubnet("foonet", NetworkSubnetArgs.builder()
.networkId(mynet.id())
.type("cloud")
.networkZone("eu-central")
.ipRange("10.0.1.0/24")
.build());
var srvnetwork = new LoadBalancerNetwork("srvnetwork", LoadBalancerNetworkArgs.builder()
.loadBalancerId(lb1.id())
.networkId(mynet.id())
.ip("10.0.1.5")
.build(), CustomResourceOptions.builder()
.dependsOn(srvnetworkHcloudNetworkSubnet)
.build());
}
}
resources:
lb1:
type: hcloud:LoadBalancer
properties:
name: lb1
loadBalancerType: lb11
networkZone: eu-central
mynet:
type: hcloud:Network
properties:
name: my-net
ipRange: 10.0.0.0/8
foonet:
type: hcloud:NetworkSubnet
properties:
networkId: ${mynet.id}
type: cloud
networkZone: eu-central
ipRange: 10.0.1.0/24
srvnetwork:
type: hcloud:LoadBalancerNetwork
properties:
loadBalancerId: ${lb1.id}
networkId: ${mynet.id}
ip: 10.0.1.5
options:
dependson:
- ${srvnetworkHcloudNetworkSubnet}
Create LoadBalancerNetwork Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new LoadBalancerNetwork(name: string, args: LoadBalancerNetworkArgs, opts?: CustomResourceOptions);
@overload
def LoadBalancerNetwork(resource_name: str,
args: LoadBalancerNetworkArgs,
opts: Optional[ResourceOptions] = None)
@overload
def LoadBalancerNetwork(resource_name: str,
opts: Optional[ResourceOptions] = None,
load_balancer_id: Optional[int] = None,
enable_public_interface: Optional[bool] = None,
ip: Optional[str] = None,
network_id: Optional[int] = None,
subnet_id: Optional[str] = None)
func NewLoadBalancerNetwork(ctx *Context, name string, args LoadBalancerNetworkArgs, opts ...ResourceOption) (*LoadBalancerNetwork, error)
public LoadBalancerNetwork(string name, LoadBalancerNetworkArgs args, CustomResourceOptions? opts = null)
public LoadBalancerNetwork(String name, LoadBalancerNetworkArgs args)
public LoadBalancerNetwork(String name, LoadBalancerNetworkArgs args, CustomResourceOptions options)
type: hcloud:LoadBalancerNetwork
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args LoadBalancerNetworkArgs
- 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 LoadBalancerNetworkArgs
- 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 LoadBalancerNetworkArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args LoadBalancerNetworkArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args LoadBalancerNetworkArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var loadBalancerNetworkResource = new HCloud.LoadBalancerNetwork("loadBalancerNetworkResource", new()
{
LoadBalancerId = 0,
EnablePublicInterface = false,
Ip = "string",
NetworkId = 0,
SubnetId = "string",
});
example, err := hcloud.NewLoadBalancerNetwork(ctx, "loadBalancerNetworkResource", &hcloud.LoadBalancerNetworkArgs{
LoadBalancerId: pulumi.Int(0),
EnablePublicInterface: pulumi.Bool(false),
Ip: pulumi.String("string"),
NetworkId: pulumi.Int(0),
SubnetId: pulumi.String("string"),
})
var loadBalancerNetworkResource = new LoadBalancerNetwork("loadBalancerNetworkResource", LoadBalancerNetworkArgs.builder()
.loadBalancerId(0)
.enablePublicInterface(false)
.ip("string")
.networkId(0)
.subnetId("string")
.build());
load_balancer_network_resource = hcloud.LoadBalancerNetwork("loadBalancerNetworkResource",
load_balancer_id=0,
enable_public_interface=False,
ip="string",
network_id=0,
subnet_id="string")
const loadBalancerNetworkResource = new hcloud.LoadBalancerNetwork("loadBalancerNetworkResource", {
loadBalancerId: 0,
enablePublicInterface: false,
ip: "string",
networkId: 0,
subnetId: "string",
});
type: hcloud:LoadBalancerNetwork
properties:
enablePublicInterface: false
ip: string
loadBalancerId: 0
networkId: 0
subnetId: string
LoadBalancerNetwork 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 LoadBalancerNetwork resource accepts the following input properties:
- Load
Balancer intId - ID of the Load Balancer.
- Enable
Public boolInterface - Enable or disable the
Load Balancers public interface. Default:
true
- Ip string
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- Network
Id int - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - Subnet
Id string - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
- Load
Balancer intId - ID of the Load Balancer.
- Enable
Public boolInterface - Enable or disable the
Load Balancers public interface. Default:
true
- Ip string
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- Network
Id int - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - Subnet
Id string - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
- load
Balancer IntegerId - ID of the Load Balancer.
- enable
Public BooleanInterface - Enable or disable the
Load Balancers public interface. Default:
true
- ip String
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- network
Id Integer - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - subnet
Id String - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
- load
Balancer numberId - ID of the Load Balancer.
- enable
Public booleanInterface - Enable or disable the
Load Balancers public interface. Default:
true
- ip string
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- network
Id number - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - subnet
Id string - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
- load_
balancer_ intid - ID of the Load Balancer.
- enable_
public_ boolinterface - Enable or disable the
Load Balancers public interface. Default:
true
- ip str
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- network_
id int - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - subnet_
id str - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
- load
Balancer NumberId - ID of the Load Balancer.
- enable
Public BooleanInterface - Enable or disable the
Load Balancers public interface. Default:
true
- ip String
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- network
Id Number - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - subnet
Id String - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
Outputs
All input properties are implicitly available as output properties. Additionally, the LoadBalancerNetwork 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 LoadBalancerNetwork Resource
Get an existing LoadBalancerNetwork 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?: LoadBalancerNetworkState, opts?: CustomResourceOptions): LoadBalancerNetwork
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
enable_public_interface: Optional[bool] = None,
ip: Optional[str] = None,
load_balancer_id: Optional[int] = None,
network_id: Optional[int] = None,
subnet_id: Optional[str] = None) -> LoadBalancerNetwork
func GetLoadBalancerNetwork(ctx *Context, name string, id IDInput, state *LoadBalancerNetworkState, opts ...ResourceOption) (*LoadBalancerNetwork, error)
public static LoadBalancerNetwork Get(string name, Input<string> id, LoadBalancerNetworkState? state, CustomResourceOptions? opts = null)
public static LoadBalancerNetwork get(String name, Output<String> id, LoadBalancerNetworkState 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.
- Enable
Public boolInterface - Enable or disable the
Load Balancers public interface. Default:
true
- Ip string
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- Load
Balancer intId - ID of the Load Balancer.
- Network
Id int - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - Subnet
Id string - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
- Enable
Public boolInterface - Enable or disable the
Load Balancers public interface. Default:
true
- Ip string
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- Load
Balancer intId - ID of the Load Balancer.
- Network
Id int - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - Subnet
Id string - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
- enable
Public BooleanInterface - Enable or disable the
Load Balancers public interface. Default:
true
- ip String
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- load
Balancer IntegerId - ID of the Load Balancer.
- network
Id Integer - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - subnet
Id String - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
- enable
Public booleanInterface - Enable or disable the
Load Balancers public interface. Default:
true
- ip string
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- load
Balancer numberId - ID of the Load Balancer.
- network
Id number - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - subnet
Id string - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
- enable_
public_ boolinterface - Enable or disable the
Load Balancers public interface. Default:
true
- ip str
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- load_
balancer_ intid - ID of the Load Balancer.
- network_
id int - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - subnet_
id str - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
- enable
Public BooleanInterface - Enable or disable the
Load Balancers public interface. Default:
true
- ip String
- IP to request to be assigned to this Load Balancer. If you do not provide this then you will be auto assigned an IP address.
- load
Balancer NumberId - ID of the Load Balancer.
- network
Id Number - ID of the network which should be added
to the Load Balancer. Required if
subnet_id
is not set. Successful creation of the resource depends on the existence of a subnet in the Hetzner Cloud Backend. Usingnetwork_id
will not create an explicit dependency between the Load Balancer and the subnet. Thereforedepends_on
may need to be used. Alternatively thesubnet_id
property can be used, which will create an explicit dependency betweenhcloud.LoadBalancerNetwork
and the existence of a subnet. - subnet
Id String - ID of the sub-network which should be
added to the Load Balancer. Required if
network_id
is not set. Note: if theip
property is missing, the Load Balancer is currently added to the last created subnet.
Import
Load Balancer Network entries can be imported using a compound ID with the following format:
<load-balancer-id>-<network-id>
$ pulumi import hcloud:index/loadBalancerNetwork:LoadBalancerNetwork myloadbalancernetwork 123-654
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcloud
Terraform Provider.