Yandex

v0.10.0 published on Thursday, Nov 18, 2021 by Pulumi

LbNetworkLoadBalancer

Creates a network load balancer in the specified folder using the data specified in the config. For more information, see the official documentation.

Example Usage

using Pulumi;
using Yandex = Pulumi.Yandex;

class MyStack : Stack
{
    public MyStack()
    {
        var foo = new Yandex.LbNetworkLoadBalancer("foo", new Yandex.LbNetworkLoadBalancerArgs
        {
            AttachedTargetGroups = 
            {
                new Yandex.Inputs.LbNetworkLoadBalancerAttachedTargetGroupArgs
                {
                    Healthchecks = 
                    {
                        new Yandex.Inputs.LbNetworkLoadBalancerAttachedTargetGroupHealthcheckArgs
                        {
                            HttpOptions = new Yandex.Inputs.LbNetworkLoadBalancerAttachedTargetGroupHealthcheckHttpOptionsArgs
                            {
                                Path = "/ping",
                                Port = 8080,
                            },
                            Name = "http",
                        },
                    },
                    TargetGroupId = yandex_lb_target_group.My_target_group.Id,
                },
            },
            Listeners = 
            {
                new Yandex.Inputs.LbNetworkLoadBalancerListenerArgs
                {
                    ExternalAddressSpec = new Yandex.Inputs.LbNetworkLoadBalancerListenerExternalAddressSpecArgs
                    {
                        IpVersion = "ipv4",
                    },
                    Name = "my-listener",
                    Port = 8080,
                },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-yandex/sdk/go/yandex"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := yandex.NewLbNetworkLoadBalancer(ctx, "foo", &yandex.LbNetworkLoadBalancerArgs{
			AttachedTargetGroups: LbNetworkLoadBalancerAttachedTargetGroupArray{
				&LbNetworkLoadBalancerAttachedTargetGroupArgs{
					Healthchecks: LbNetworkLoadBalancerAttachedTargetGroupHealthcheckArray{
						&LbNetworkLoadBalancerAttachedTargetGroupHealthcheckArgs{
							HttpOptions: &LbNetworkLoadBalancerAttachedTargetGroupHealthcheckHttpOptionsArgs{
								Path: pulumi.String("/ping"),
								Port: pulumi.Int(8080),
							},
							Name: pulumi.String("http"),
						},
					},
					TargetGroupId: pulumi.Any(yandex_lb_target_group.My - target - group.Id),
				},
			},
			Listeners: LbNetworkLoadBalancerListenerArray{
				&LbNetworkLoadBalancerListenerArgs{
					ExternalAddressSpec: &LbNetworkLoadBalancerListenerExternalAddressSpecArgs{
						IpVersion: pulumi.String("ipv4"),
					},
					Name: pulumi.String("my-listener"),
					Port: pulumi.Int(8080),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_yandex as yandex

foo = yandex.LbNetworkLoadBalancer("foo",
    attached_target_groups=[yandex.LbNetworkLoadBalancerAttachedTargetGroupArgs(
        healthchecks=[yandex.LbNetworkLoadBalancerAttachedTargetGroupHealthcheckArgs(
            http_options=yandex.LbNetworkLoadBalancerAttachedTargetGroupHealthcheckHttpOptionsArgs(
                path="/ping",
                port=8080,
            ),
            name="http",
        )],
        target_group_id=yandex_lb_target_group["my-target-group"]["id"],
    )],
    listeners=[yandex.LbNetworkLoadBalancerListenerArgs(
        external_address_spec=yandex.LbNetworkLoadBalancerListenerExternalAddressSpecArgs(
            ip_version="ipv4",
        ),
        name="my-listener",
        port=8080,
    )])
import * as pulumi from "@pulumi/pulumi";
import * as yandex from "@pulumi/yandex";

const foo = new yandex.LbNetworkLoadBalancer("foo", {
    attachedTargetGroups: [{
        healthchecks: [{
            httpOptions: {
                path: "/ping",
                port: 8080,
            },
            name: "http",
        }],
        targetGroupId: yandex_lb_target_group_my_target_group.id,
    }],
    listeners: [{
        externalAddressSpec: {
            ipVersion: "ipv4",
        },
        name: "my-listener",
        port: 8080,
    }],
});

Create a LbNetworkLoadBalancer Resource

new LbNetworkLoadBalancer(name: string, args?: LbNetworkLoadBalancerArgs, opts?: CustomResourceOptions);
@overload
def LbNetworkLoadBalancer(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          attached_target_groups: Optional[Sequence[LbNetworkLoadBalancerAttachedTargetGroupArgs]] = None,
                          description: Optional[str] = None,
                          folder_id: Optional[str] = None,
                          labels: Optional[Mapping[str, str]] = None,
                          listeners: Optional[Sequence[LbNetworkLoadBalancerListenerArgs]] = None,
                          name: Optional[str] = None,
                          region_id: Optional[str] = None,
                          type: Optional[str] = None)
@overload
def LbNetworkLoadBalancer(resource_name: str,
                          args: Optional[LbNetworkLoadBalancerArgs] = None,
                          opts: Optional[ResourceOptions] = None)
func NewLbNetworkLoadBalancer(ctx *Context, name string, args *LbNetworkLoadBalancerArgs, opts ...ResourceOption) (*LbNetworkLoadBalancer, error)
public LbNetworkLoadBalancer(string name, LbNetworkLoadBalancerArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args LbNetworkLoadBalancerArgs
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 LbNetworkLoadBalancerArgs
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 LbNetworkLoadBalancerArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args LbNetworkLoadBalancerArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

LbNetworkLoadBalancer 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 LbNetworkLoadBalancer resource accepts the following input properties:

AttachedTargetGroups List<LbNetworkLoadBalancerAttachedTargetGroupArgs>
An AttachedTargetGroup resource. The structure is documented below.
Description string
An optional description of the network load balancer. Provide this property when you create the resource.
FolderId string
The ID of the folder to which the resource belongs. If omitted, the provider folder is used.
Labels Dictionary<string, string>
Labels to assign to this network load balancer. A list of key/value pairs.
Listeners List<LbNetworkLoadBalancerListenerArgs>
Listener specification that will be used by a network load balancer. The structure is documented below.
Name string
Name of the listener. The name must be unique for each listener on a single load balancer.
RegionId string
ID of the availability zone where the network load balancer resides. The default is ‘ru-central1’.
Type string
Type of the network load balancer. Must be one of ‘external’ or ‘internal’. The default is ‘external’.
AttachedTargetGroups []LbNetworkLoadBalancerAttachedTargetGroupArgs
An AttachedTargetGroup resource. The structure is documented below.
Description string
An optional description of the network load balancer. Provide this property when you create the resource.
FolderId string
The ID of the folder to which the resource belongs. If omitted, the provider folder is used.
Labels map[string]string
Labels to assign to this network load balancer. A list of key/value pairs.
Listeners []LbNetworkLoadBalancerListenerArgs
Listener specification that will be used by a network load balancer. The structure is documented below.
Name string
Name of the listener. The name must be unique for each listener on a single load balancer.
RegionId string
ID of the availability zone where the network load balancer resides. The default is ‘ru-central1’.
Type string
Type of the network load balancer. Must be one of ‘external’ or ‘internal’. The default is ‘external’.
attachedTargetGroups LbNetworkLoadBalancerAttachedTargetGroupArgs[]
An AttachedTargetGroup resource. The structure is documented below.
description string
An optional description of the network load balancer. Provide this property when you create the resource.
folderId string
The ID of the folder to which the resource belongs. If omitted, the provider folder is used.
labels {[key: string]: string}
Labels to assign to this network load balancer. A list of key/value pairs.
listeners LbNetworkLoadBalancerListenerArgs[]
Listener specification that will be used by a network load balancer. The structure is documented below.
name string
Name of the listener. The name must be unique for each listener on a single load balancer.
regionId string
ID of the availability zone where the network load balancer resides. The default is ‘ru-central1’.
type string
Type of the network load balancer. Must be one of ‘external’ or ‘internal’. The default is ‘external’.
attached_target_groups Sequence[LbNetworkLoadBalancerAttachedTargetGroupArgs]
An AttachedTargetGroup resource. The structure is documented below.
description str
An optional description of the network load balancer. Provide this property when you create the resource.
folder_id str
The ID of the folder to which the resource belongs. If omitted, the provider folder is used.
labels Mapping[str, str]
Labels to assign to this network load balancer. A list of key/value pairs.
listeners Sequence[LbNetworkLoadBalancerListenerArgs]
Listener specification that will be used by a network load balancer. The structure is documented below.
name str
Name of the listener. The name must be unique for each listener on a single load balancer.
region_id str
ID of the availability zone where the network load balancer resides. The default is ‘ru-central1’.
type str
Type of the network load balancer. Must be one of ‘external’ or ‘internal’. The default is ‘external’.

Outputs

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

CreatedAt string
The network load balancer creation timestamp.
Id string
The provider-assigned unique ID for this managed resource.
CreatedAt string
The network load balancer creation timestamp.
Id string
The provider-assigned unique ID for this managed resource.
createdAt string
The network load balancer creation timestamp.
id string
The provider-assigned unique ID for this managed resource.
created_at str
The network load balancer creation timestamp.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing LbNetworkLoadBalancer Resource

Get an existing LbNetworkLoadBalancer 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?: LbNetworkLoadBalancerState, opts?: CustomResourceOptions): LbNetworkLoadBalancer
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        attached_target_groups: Optional[Sequence[LbNetworkLoadBalancerAttachedTargetGroupArgs]] = None,
        created_at: Optional[str] = None,
        description: Optional[str] = None,
        folder_id: Optional[str] = None,
        labels: Optional[Mapping[str, str]] = None,
        listeners: Optional[Sequence[LbNetworkLoadBalancerListenerArgs]] = None,
        name: Optional[str] = None,
        region_id: Optional[str] = None,
        type: Optional[str] = None) -> LbNetworkLoadBalancer
func GetLbNetworkLoadBalancer(ctx *Context, name string, id IDInput, state *LbNetworkLoadBalancerState, opts ...ResourceOption) (*LbNetworkLoadBalancer, error)
public static LbNetworkLoadBalancer Get(string name, Input<string> id, LbNetworkLoadBalancerState? 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:

AttachedTargetGroups List<LbNetworkLoadBalancerAttachedTargetGroupArgs>
An AttachedTargetGroup resource. The structure is documented below.
CreatedAt string
The network load balancer creation timestamp.
Description string
An optional description of the network load balancer. Provide this property when you create the resource.
FolderId string
The ID of the folder to which the resource belongs. If omitted, the provider folder is used.
Labels Dictionary<string, string>
Labels to assign to this network load balancer. A list of key/value pairs.
Listeners List<LbNetworkLoadBalancerListenerArgs>
Listener specification that will be used by a network load balancer. The structure is documented below.
Name string
Name of the listener. The name must be unique for each listener on a single load balancer.
RegionId string
ID of the availability zone where the network load balancer resides. The default is ‘ru-central1’.
Type string
Type of the network load balancer. Must be one of ‘external’ or ‘internal’. The default is ‘external’.
AttachedTargetGroups []LbNetworkLoadBalancerAttachedTargetGroupArgs
An AttachedTargetGroup resource. The structure is documented below.
CreatedAt string
The network load balancer creation timestamp.
Description string
An optional description of the network load balancer. Provide this property when you create the resource.
FolderId string
The ID of the folder to which the resource belongs. If omitted, the provider folder is used.
Labels map[string]string
Labels to assign to this network load balancer. A list of key/value pairs.
Listeners []LbNetworkLoadBalancerListenerArgs
Listener specification that will be used by a network load balancer. The structure is documented below.
Name string
Name of the listener. The name must be unique for each listener on a single load balancer.
RegionId string
ID of the availability zone where the network load balancer resides. The default is ‘ru-central1’.
Type string
Type of the network load balancer. Must be one of ‘external’ or ‘internal’. The default is ‘external’.
attachedTargetGroups LbNetworkLoadBalancerAttachedTargetGroupArgs[]
An AttachedTargetGroup resource. The structure is documented below.
createdAt string
The network load balancer creation timestamp.
description string
An optional description of the network load balancer. Provide this property when you create the resource.
folderId string
The ID of the folder to which the resource belongs. If omitted, the provider folder is used.
labels {[key: string]: string}
Labels to assign to this network load balancer. A list of key/value pairs.
listeners LbNetworkLoadBalancerListenerArgs[]
Listener specification that will be used by a network load balancer. The structure is documented below.
name string
Name of the listener. The name must be unique for each listener on a single load balancer.
regionId string
ID of the availability zone where the network load balancer resides. The default is ‘ru-central1’.
type string
Type of the network load balancer. Must be one of ‘external’ or ‘internal’. The default is ‘external’.
attached_target_groups Sequence[LbNetworkLoadBalancerAttachedTargetGroupArgs]
An AttachedTargetGroup resource. The structure is documented below.
created_at str
The network load balancer creation timestamp.
description str
An optional description of the network load balancer. Provide this property when you create the resource.
folder_id str
The ID of the folder to which the resource belongs. If omitted, the provider folder is used.
labels Mapping[str, str]
Labels to assign to this network load balancer. A list of key/value pairs.
listeners Sequence[LbNetworkLoadBalancerListenerArgs]
Listener specification that will be used by a network load balancer. The structure is documented below.
name str
Name of the listener. The name must be unique for each listener on a single load balancer.
region_id str
ID of the availability zone where the network load balancer resides. The default is ‘ru-central1’.
type str
Type of the network load balancer. Must be one of ‘external’ or ‘internal’. The default is ‘external’.

Supporting Types

LbNetworkLoadBalancerAttachedTargetGroup

Healthchecks List<LbNetworkLoadBalancerAttachedTargetGroupHealthcheck>
A HealthCheck resource. The structure is documented below.
TargetGroupId string
ID of the target group.
Healthchecks []LbNetworkLoadBalancerAttachedTargetGroupHealthcheck
A HealthCheck resource. The structure is documented below.
TargetGroupId string
ID of the target group.
healthchecks LbNetworkLoadBalancerAttachedTargetGroupHealthcheck[]
A HealthCheck resource. The structure is documented below.
targetGroupId string
ID of the target group.
healthchecks Sequence[LbNetworkLoadBalancerAttachedTargetGroupHealthcheck]
A HealthCheck resource. The structure is documented below.
target_group_id str
ID of the target group.

LbNetworkLoadBalancerAttachedTargetGroupHealthcheck

Name string
Name of the listener. The name must be unique for each listener on a single load balancer.
HealthyThreshold int
Number of successful health checks required in order to set the HEALTHY status for the target.
HttpOptions LbNetworkLoadBalancerAttachedTargetGroupHealthcheckHttpOptions
Options for HTTP health check. The structure is documented below.
Interval int
The interval between health checks. The default is 2 seconds.
TcpOptions LbNetworkLoadBalancerAttachedTargetGroupHealthcheckTcpOptions
Options for TCP health check. The structure is documented below.
Timeout int
Timeout for a target to return a response for the health check. The default is 1 second.
UnhealthyThreshold int
Number of failed health checks before changing the status to UNHEALTHY. The default is 2.
Name string
Name of the listener. The name must be unique for each listener on a single load balancer.
HealthyThreshold int
Number of successful health checks required in order to set the HEALTHY status for the target.
HttpOptions LbNetworkLoadBalancerAttachedTargetGroupHealthcheckHttpOptions
Options for HTTP health check. The structure is documented below.
Interval int
The interval between health checks. The default is 2 seconds.
TcpOptions LbNetworkLoadBalancerAttachedTargetGroupHealthcheckTcpOptions
Options for TCP health check. The structure is documented below.
Timeout int
Timeout for a target to return a response for the health check. The default is 1 second.
UnhealthyThreshold int
Number of failed health checks before changing the status to UNHEALTHY. The default is 2.
name string
Name of the listener. The name must be unique for each listener on a single load balancer.
healthyThreshold number
Number of successful health checks required in order to set the HEALTHY status for the target.
httpOptions LbNetworkLoadBalancerAttachedTargetGroupHealthcheckHttpOptions
Options for HTTP health check. The structure is documented below.
interval number
The interval between health checks. The default is 2 seconds.
tcpOptions LbNetworkLoadBalancerAttachedTargetGroupHealthcheckTcpOptions
Options for TCP health check. The structure is documented below.
timeout number
Timeout for a target to return a response for the health check. The default is 1 second.
unhealthyThreshold number
Number of failed health checks before changing the status to UNHEALTHY. The default is 2.
name str
Name of the listener. The name must be unique for each listener on a single load balancer.
healthy_threshold int
Number of successful health checks required in order to set the HEALTHY status for the target.
http_options LbNetworkLoadBalancerAttachedTargetGroupHealthcheckHttpOptions
Options for HTTP health check. The structure is documented below.
interval int
The interval between health checks. The default is 2 seconds.
tcp_options LbNetworkLoadBalancerAttachedTargetGroupHealthcheckTcpOptions
Options for TCP health check. The structure is documented below.
timeout int
Timeout for a target to return a response for the health check. The default is 1 second.
unhealthy_threshold int
Number of failed health checks before changing the status to UNHEALTHY. The default is 2.

LbNetworkLoadBalancerAttachedTargetGroupHealthcheckHttpOptions

Port int
Port for incoming traffic.
Path string
URL path to set for health checking requests for every target in the target group. For example /ping. The default path is /.
Port int
Port for incoming traffic.
Path string
URL path to set for health checking requests for every target in the target group. For example /ping. The default path is /.
port number
Port for incoming traffic.
path string
URL path to set for health checking requests for every target in the target group. For example /ping. The default path is /.
port int
Port for incoming traffic.
path str
URL path to set for health checking requests for every target in the target group. For example /ping. The default path is /.

LbNetworkLoadBalancerAttachedTargetGroupHealthcheckTcpOptions

Port int
Port for incoming traffic.
Port int
Port for incoming traffic.
port number
Port for incoming traffic.
port int
Port for incoming traffic.

LbNetworkLoadBalancerListener

Name string
Name of the listener. The name must be unique for each listener on a single load balancer.
Port int
Port for incoming traffic.
ExternalAddressSpec LbNetworkLoadBalancerListenerExternalAddressSpec
External IP address specification. The structure is documented below.
InternalAddressSpec LbNetworkLoadBalancerListenerInternalAddressSpec
Internal IP address specification. The structure is documented below.
Protocol string
Protocol for incoming traffic. TCP or UDP and the default is TCP.
TargetPort int
Port of a target. The default is the same as listener’s port.
Name string
Name of the listener. The name must be unique for each listener on a single load balancer.
Port int
Port for incoming traffic.
ExternalAddressSpec LbNetworkLoadBalancerListenerExternalAddressSpec
External IP address specification. The structure is documented below.
InternalAddressSpec LbNetworkLoadBalancerListenerInternalAddressSpec
Internal IP address specification. The structure is documented below.
Protocol string
Protocol for incoming traffic. TCP or UDP and the default is TCP.
TargetPort int
Port of a target. The default is the same as listener’s port.
name string
Name of the listener. The name must be unique for each listener on a single load balancer.
port number
Port for incoming traffic.
externalAddressSpec LbNetworkLoadBalancerListenerExternalAddressSpec
External IP address specification. The structure is documented below.
internalAddressSpec LbNetworkLoadBalancerListenerInternalAddressSpec
Internal IP address specification. The structure is documented below.
protocol string
Protocol for incoming traffic. TCP or UDP and the default is TCP.
targetPort number
Port of a target. The default is the same as listener’s port.
name str
Name of the listener. The name must be unique for each listener on a single load balancer.
port int
Port for incoming traffic.
external_address_spec LbNetworkLoadBalancerListenerExternalAddressSpec
External IP address specification. The structure is documented below.
internal_address_spec LbNetworkLoadBalancerListenerInternalAddressSpec
Internal IP address specification. The structure is documented below.
protocol str
Protocol for incoming traffic. TCP or UDP and the default is TCP.
target_port int
Port of a target. The default is the same as listener’s port.

LbNetworkLoadBalancerListenerExternalAddressSpec

Address string
Internal IP address for a listener. Must belong to the subnet that is referenced in subnet_id. IP address will be allocated if it wasn’t been set.
IpVersion string
IP version of the internal addresses that the load balancer works with. Must be one of ipv4 or ipv6. The default is ipv4.
Address string
Internal IP address for a listener. Must belong to the subnet that is referenced in subnet_id. IP address will be allocated if it wasn’t been set.
IpVersion string
IP version of the internal addresses that the load balancer works with. Must be one of ipv4 or ipv6. The default is ipv4.
address string
Internal IP address for a listener. Must belong to the subnet that is referenced in subnet_id. IP address will be allocated if it wasn’t been set.
ipVersion string
IP version of the internal addresses that the load balancer works with. Must be one of ipv4 or ipv6. The default is ipv4.
address str
Internal IP address for a listener. Must belong to the subnet that is referenced in subnet_id. IP address will be allocated if it wasn’t been set.
ip_version str
IP version of the internal addresses that the load balancer works with. Must be one of ipv4 or ipv6. The default is ipv4.

LbNetworkLoadBalancerListenerInternalAddressSpec

SubnetId string
ID of the subnet to which the internal IP address belongs.
Address string
Internal IP address for a listener. Must belong to the subnet that is referenced in subnet_id. IP address will be allocated if it wasn’t been set.
IpVersion string
IP version of the internal addresses that the load balancer works with. Must be one of ipv4 or ipv6. The default is ipv4.
SubnetId string
ID of the subnet to which the internal IP address belongs.
Address string
Internal IP address for a listener. Must belong to the subnet that is referenced in subnet_id. IP address will be allocated if it wasn’t been set.
IpVersion string
IP version of the internal addresses that the load balancer works with. Must be one of ipv4 or ipv6. The default is ipv4.
subnetId string
ID of the subnet to which the internal IP address belongs.
address string
Internal IP address for a listener. Must belong to the subnet that is referenced in subnet_id. IP address will be allocated if it wasn’t been set.
ipVersion string
IP version of the internal addresses that the load balancer works with. Must be one of ipv4 or ipv6. The default is ipv4.
subnet_id str
ID of the subnet to which the internal IP address belongs.
address str
Internal IP address for a listener. Must belong to the subnet that is referenced in subnet_id. IP address will be allocated if it wasn’t been set.
ip_version str
IP version of the internal addresses that the load balancer works with. Must be one of ipv4 or ipv6. The default is ipv4.

Import

A network load balancer can be imported using the id of the resource, e.g.

 $ pulumi import yandex:index/lbNetworkLoadBalancer:LbNetworkLoadBalancer default network_load_balancer_id

Package Details

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