/terraform-alicloud-slb-udp

Terraform Module for creating UDP Load Balancer on Alibaba Cloud.

Primary LanguageHCLApache License 2.0Apache-2.0

Alibaba Cloud Load Balancer (SLB) UDP Terraform Module terraform-alicloud-slb-udp

English | 简体中文

Terraform Module for creating UDP Load Balancer on Alibaba Cloud.

These types of resources are supported:

Usage

module "slb_udp" {
  source              = "terraform-alicloud-modules/slb-udp/alicloud"
  create_slb          = true
  create_udp_listener = true
  specification       = "slb.s2.small"
  
  ########################
  #udp 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          = "/"
  }
  
  // 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"
  }
}

Examples

Notes

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-udp"
}

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_udp" {
  source              = "terraform-alicloud-modules/slb-udp/alicloud"
  version             = "1.0.0"
  region              = "cn-beijing"
  profile             = "Your-Profile-Name"
  create_slb          = true
  create_udp_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_udp" {
  source              = "terraform-alicloud-modules/slb-udp/alicloud"
  create_slb          = true
  create_udp_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_udp" {
  source              = "terraform-alicloud-modules/slb-udp/alicloud"
  providers = {
    alicloud = alicloud.bj
  }
  create_slb          = true
  create_udp_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

Terraform versions

Name Version
terraform >= 0.13.0
alicloud >= 1.56.0

Submit Issues

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.

Authors

Created and maintained by Alibaba Cloud Terraform Team(terraform@alibabacloud.com)

License

Apache 2 Licensed. See LICENSE for full details.

Reference