LoadBalancerArgs

data class LoadBalancerArgs(val addressIpVersion: Output<String>? = null, val addressType: Output<String>? = null, val bandwidthPackageId: Output<String>? = null, val crossZoneEnabled: Output<Boolean>? = null, val deletionProtectionEnabled: Output<Boolean>? = null, val deletionProtectionReason: Output<String>? = null, val loadBalancerName: Output<String>? = null, val loadBalancerType: Output<String>? = null, val modificationProtectionReason: Output<String>? = null, val modificationProtectionStatus: Output<String>? = null, val resourceGroupId: Output<String>? = null, val tags: Output<Map<String, Any>>? = null, val vpcId: Output<String>? = null, val zoneMappings: Output<List<LoadBalancerZoneMappingArgs>>? = null) : ConvertibleToJava<LoadBalancerArgs>

Provides a NLB Load Balancer resource. For information about NLB Load Balancer and how to use it, see What is Load Balancer.

NOTE: Available since v1.191.0.

Example Usage

Basic Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.nlb.NlbFunctions;
import com.pulumi.alicloud.nlb.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
import com.pulumi.alicloud.vpc.inputs.GetSwitchesArgs;
import com.pulumi.alicloud.nlb.LoadBalancer;
import com.pulumi.alicloud.nlb.LoadBalancerArgs;
import com.pulumi.alicloud.nlb.inputs.LoadBalancerZoneMappingArgs;
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) {
final var defaultZones = NlbFunctions.getZones();
final var defaultNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder()
.nameRegex("default-NODELETING")
.build());
final var defaultResourceGroups = ResourcemanagerFunctions.getResourceGroups();
final var default1 = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
.vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
final var default2 = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
.vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[1].id()))
.build());
final var zoneId1 = defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id());
final var vswitchId1 = default1.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0]);
final var zoneId2 = defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[1].id());
final var vswitchId2 = default2.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0]);
var defaultLoadBalancer = new LoadBalancer("defaultLoadBalancer", LoadBalancerArgs.builder()
.loadBalancerName(var_.name())
.resourceGroupId(defaultResourceGroups.applyValue(getResourceGroupsResult -> getResourceGroupsResult.ids()[0]))
.loadBalancerType("Network")
.addressType("Internet")
.addressIpVersion("Ipv4")
.tags(Map.ofEntries(
Map.entry("Created", "tfTestAcc0"),
Map.entry("For", "Tftestacc 0")
))
.vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
.zoneMappings(
LoadBalancerZoneMappingArgs.builder()
.vswitchId(vswitchId1)
.zoneId(zoneId1)
.build(),
LoadBalancerZoneMappingArgs.builder()
.vswitchId(vswitchId2)
.zoneId(zoneId2)
.build())
.build());
}
}

Import

NLB Load Balancer can be imported using the id, e.g.

$ pulumi import alicloud:nlb/loadBalancer:LoadBalancer example <id>

Constructors

Link copied to clipboard
fun LoadBalancerArgs(addressIpVersion: Output<String>? = null, addressType: Output<String>? = null, bandwidthPackageId: Output<String>? = null, crossZoneEnabled: Output<Boolean>? = null, deletionProtectionEnabled: Output<Boolean>? = null, deletionProtectionReason: Output<String>? = null, loadBalancerName: Output<String>? = null, loadBalancerType: Output<String>? = null, modificationProtectionReason: Output<String>? = null, modificationProtectionStatus: Output<String>? = null, resourceGroupId: Output<String>? = null, tags: Output<Map<String, Any>>? = null, vpcId: Output<String>? = null, zoneMappings: Output<List<LoadBalancerZoneMappingArgs>>? = null)

Functions

Link copied to clipboard
open override fun toJava(): LoadBalancerArgs

Properties

Link copied to clipboard
val addressIpVersion: Output<String>? = null

The protocol version. Valid values:

Link copied to clipboard
val addressType: Output<String>? = null

The type of IPv4 address used by the NLB instance. Valid values:

Link copied to clipboard
val bandwidthPackageId: Output<String>? = null

The ID of the EIP bandwidth plan that is associated with the NLB instance if the NLB instance uses a public IP address.

Link copied to clipboard
val crossZoneEnabled: Output<Boolean>? = null

Specifies whether to enable cross-zone load balancing for the NLB instance.

Link copied to clipboard
val deletionProtectionEnabled: Output<Boolean>? = null

Specifies whether to enable deletion protection. Default value: false. Valid values:

Link copied to clipboard
val deletionProtectionReason: Output<String>? = null

The reason why the deletion protection feature is enabled or disabled. The deletion_protection_reason takes effect only when deletion_protection_enabled is set to true.

Link copied to clipboard
val loadBalancerName: Output<String>? = null

The name of the NLB instance. The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

Link copied to clipboard
val loadBalancerType: Output<String>? = null

The type of the instance. Set the value to Network, which specifies an NLB instance.

Link copied to clipboard

The reason why the configuration read-only mode is enabled. The modification_protection_reason takes effect only when modification_protection_status is set to ConsoleProtection.

Link copied to clipboard

Specifies whether to enable the configuration read-only mode. Default value: NonProtection. Valid values:

Link copied to clipboard
val resourceGroupId: Output<String>? = null

The ID of the resource group.

Link copied to clipboard
val tags: Output<Map<String, Any>>? = null

A mapping of tags to assign to the resource.

Link copied to clipboard
val vpcId: Output<String>? = null

The ID of the VPC where the NLB instance is deployed.

Link copied to clipboard

Available Area Configuration List. You must add at least two zones. You can add a maximum of 10 zones. See zone_mappings below.