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.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
import com.pulumi.alicloud.nlb.NlbFunctions;
import com.pulumi.alicloud.nlb.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("tf-example");
final var defaultResourceGroups = ResourcemanagerFunctions.getResourceGroups();
final var defaultZones = NlbFunctions.getZones();
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.4.0.0/16")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("10.4.0.0/24")
.vpcId(defaultNetwork.id())
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
var default1 = new Switch("default1", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("10.4.1.0/24")
.vpcId(defaultNetwork.id())
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[1].id()))
.build());
var defaultLoadBalancer = new LoadBalancer("defaultLoadBalancer", LoadBalancerArgs.builder()
.loadBalancerName(name)
.resourceGroupId(defaultResourceGroups.applyValue(getResourceGroupsResult -> getResourceGroupsResult.ids()[0]))
.loadBalancerType("Network")
.addressType("Internet")
.addressIpVersion("Ipv4")
.vpcId(defaultNetwork.id())
.tags(Map.ofEntries(
Map.entry("Created", "TF"),
Map.entry("For", "example")
))
.zoneMappings(
LoadBalancerZoneMappingArgs.builder()
.vswitchId(defaultSwitch.id())
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build(),
LoadBalancerZoneMappingArgs.builder()
.vswitchId(default1.id())
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[1].id()))
.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.