LoadBalancer

class LoadBalancer : KotlinCustomResource

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>

Properties

Link copied to clipboard

The protocol version. Valid values:

Link copied to clipboard
val addressType: Output<String>

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

Link copied to clipboard

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 createTime: Output<String>

The time when the resource was created. The time is displayed in UTC in yyyy-MM-ddTHH:mm:ssZ format.

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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 dnsName: Output<String>

The domain name of the NLB instance.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val ipv6AddressType: Output<String>

The type of IPv6 address used by the NLB instance.

Link copied to clipboard

The business status of the NLB instance.

Link copied to clipboard

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

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 pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val resourceGroupId: Output<String>

The ID of the resource group.

Link copied to clipboard
val status: Output<String>

The status of the NLB instance.

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

A mapping of tags to assign to the resource.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val vpcId: Output<String>

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.