alicloud_slb_load_balancer

Provides an Application Load Balancer resource.

Example Usage

# Create a intranet SLB instance
variable "slb_load_balancer_name" {
  default = "forSlbLoadBalancer"
}

data "alicloud_zones" "load_balancer" {
  available_resource_creation = "VSwitch"
}

resource "alicloud_vpc" "load_balancer" {
  vpc_name = var.slb_load_balancer_name
}

resource "alicloud_vswitch" "load_balancer" {
  vpc_id       = alicloud_vpc.load_balancer.id
  cidr_block   = "172.16.0.0/21"
  zone_id      = data.alicloud_zones.load_balancer.zones[0].id
  vswitch_name = var.slb_load_balancer_name
}

resource "alicloud_slb_load_balancer" "load_balancer" {
  load_balancer_name = var.slb_load_balancer_name
  address_type       = "intranet"
  load_balancer_spec = "slb.s2.small"
  vswitch_id         = alicloud_vswitch.load_balancer.id
  tags = {
    info = "create for internet"
  }
  instance_charge_type = "PayBySpec"
}

Deleting alicloud_slb_load_balancer or removing it from your configuration

The alicloud_slb_load_balancer resource allows you to manage payment_type = "Subscription" load balancer, but Terraform cannot destroy it. Deleting the subscription resource or removing it from your configuration will remove it from your state file and management, but will not destroy the Load Balancer. You can resume managing the subscription load balancer via the AlibabaCloud Console.

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

Load balancer can be imported using the id, e.g.

$ terraform import alicloud_slb_load_balancer.example lb-abc123456