alicloud_ga_endpoint_groups

This data source provides the Global Accelerator (GA) Endpoint Groups of the current Alibaba Cloud user.

Example Usage

Basic Usage

variable "region" {
  default = "cn-hangzhou"
}

variable "name" {
  default = "tf-example"
}

provider "alicloud" {
  region = var.region
}

data "alicloud_ga_accelerators" "default" {
  status = "active"
}

resource "alicloud_ga_bandwidth_package" "default" {
  bandwidth              = 100
  type                   = "Basic"
  bandwidth_type         = "Basic"
  payment_type           = "PayAsYouGo"
  billing_type           = "PayBy95"
  ratio                  = 30
  bandwidth_package_name = var.name
  auto_pay               = true
  auto_use_coupon        = true
}

resource "alicloud_ga_bandwidth_package_attachment" "default" {
  accelerator_id       = data.alicloud_ga_accelerators.default.ids.0
  bandwidth_package_id = alicloud_ga_bandwidth_package.default.id
}

resource "alicloud_ga_listener" "default" {
  accelerator_id  = alicloud_ga_bandwidth_package_attachment.default.accelerator_id
  client_affinity = "SOURCE_IP"
  protocol        = "UDP"
  name            = var.name
  port_ranges {
    from_port = "60"
    to_port   = "70"
  }
}

resource "alicloud_eip_address" "default" {
  bandwidth            = "10"
  internet_charge_type = "PayByBandwidth"
  address_name         = var.name
}

resource "alicloud_ga_endpoint_group" "default" {
  accelerator_id                = alicloud_ga_listener.default.accelerator_id
  listener_id                   = alicloud_ga_listener.default.id
  description                   = var.name
  name                          = var.name
  threshold_count               = 4
  traffic_percentage            = 20
  endpoint_group_region         = "cn-hangzhou"
  health_check_interval_seconds = "3"
  health_check_path             = "/healthcheck"
  health_check_port             = "9999"
  health_check_protocol         = "http"
  port_overrides {
    endpoint_port = "10"
    listener_port = "60"
  }
  endpoint_configurations {
    endpoint = alicloud_eip_address.default.ip_address
    type     = "PublicIp"
    weight   = "20"
  }
}

data "alicloud_ga_endpoint_groups" "default" {
  accelerator_id = alicloud_ga_endpoint_group.default.accelerator_id
  ids            = [alicloud_ga_endpoint_group.default.id]
}

output "first_ga_endpoint_group_id" {
  value = data.alicloud_ga_endpoint_groups.default.groups.0.id
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported in addition to the arguments listed above: