English | 简体中文
Terraform Module for creating TCP Load Balancer on Alibaba Cloud.
These types of resources are supported:
module "slb_tcp" {
source = "terraform-alicloud-modules/slb-tcp/alicloud"
create_slb = true
create_tcp_listener = true
specification = "slb.s2.small"
########################
#tcp listeners creation#
########################
listeners = [
{
backend_port = "80"
frontend_port = "80"
bandwidth = "-1"
scheduler = "wrr"
healthy_threshold = "4"
gzip = "false"
}
]
########################
#attach virtual servers#
########################
servers_of_virtual_server_group = [
{
server_ids = "i-bp1xxxxxxxxxx1,i-bp1xxxxxxxxxx2"
port = "80"
weight = "100"
type = "ecs"
},
// Using default value
{
server_ids = "i-bp1xxxxxxxxxx3"
}
]
// health_check will apply to all of listeners if health checking is not set in the listeners
health_check = {
health_check = "on"
health_check_type = "tcp"
healthy_threshold = "3"
unhealthy_threshold = "2"
health_check_timeout = "5"
health_check_interval = "2"
health_check_connect_port = "80"
health_check_uri = "/"
health_check_http_code = "http_2xx"
}
// advanced_setting will apply to all of listeners if some fields are not set in the listeners
advanced_setting = {
sticky_session = "on"
sticky_session_type = "server"
cookie_timeout = "86400"
gzip = "false"
retrive_slb_ip = "true"
retrive_slb_id = "false"
retrive_slb_proto = "true"
persistence_timeout = "5"
}
}
From the version v1.1.0, the module has removed the following provider
setting:
provider "alicloud" {
profile = var.profile != "" ? var.profile : null
shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null
region = var.region != "" ? var.region : null
skip_region_validation = var.skip_region_validation
configuration_source = "terraform-alicloud-modules/slb-tcp"
}
If you still want to use the provider
setting to apply this module, you can specify a supported version, like 1.0.0:
module "slb_tcp" {
source = "terraform-alicloud-modules/slb-tcp/alicloud"
version = "1.0.0"
region = "cn-beijing"
profile = "Your-Profile-Name"
create_slb = true
create_tcp_listener = true
// ...
}
If you want to upgrade the module to 1.1.0 or higher in-place, you can define a provider which same region with previous region:
provider "alicloud" {
region = "cn-beijing"
profile = "Your-Profile-Name"
}
module "slb_tcp" {
source = "terraform-alicloud-modules/slb-tcp/alicloud"
create_slb = true
create_tcp_listener = true
// ...
}
or specify an alias provider with a defined region to the module using providers
:
provider "alicloud" {
region = "cn-beijing"
profile = "Your-Profile-Name"
alias = "bj"
}
module "slb_tcp" {
source = "terraform-alicloud-modules/slb-tcp/alicloud"
providers = {
alicloud = alicloud.bj
}
create_slb = true
create_tcp_listener = true
// ...
}
and then run terraform init
and terraform apply
to make the defined provider effect to the existing module state.
More details see How to use provider in the module
Name | Version |
---|---|
terraform | >= 0.13.0 |
alicloud | >= 1.56.0 |
If you have any problems when using this module, please opening a provider issue and let us know.
Note: There does not recommend to open an issue on this repo.
Created and maintained by Alibaba Cloud Terraform Team(terraform@alibabacloud.com)
Apache 2 Licensed. See LICENSE for full details.