Skip to content

GLB Service

ppwarwick edited this page Oct 20, 2017 · 2 revisions

GLB Service example

The following template example shows how to set up a GLB service and it's dependencies. There is a DNS zone file, DNS zone configuration, a GLB monitor, two locations and a GLB service.

resource "brocadevtm_dns_zone_file" "example" {
name = "example.com.db"
  dns_zone_config = <<DNS_ZONE_FILE
$TTL 3600
@                         30    IN  SOA ns1.example.com. hostmaster.example.com. (
                                        01; serial
                                        3600; refresh after 1 hour
                                        300; retry after 5 minutes
                                        1209600; expire after 2 weeks
                                        30); minimum TTL of 30 seconds
@                         30    IN  NS  ns1.example.com.
ns1                       30    IN  A   10.0.1.2
example-service           60    IN  A   10.1.1.10
                          60    IN  A   10.1.2.10
DNS_ZONE_FILE
}

resource "brocadevtm_dns_zone" "example" {
  name = "example.com"
  origin = "example.com"
  zone_file = "${brocadevtm_dns_zone_file.example.name}"
}

resource "brocadevtm_location" "example-one" {
  name = "example-location-one"
  location_id = 101
  latitude = -16.353417
  longitude = 126.687568
  note = "Example location One"
  type = "glb"
}

resource "brocadevtm_location" "example-two" {
  name = "example-location-two"
  location_id = 102
  latitude = -36.353417
  longitude = 146.687568
  note = "Example location Two"
  type = "glb"
}

resource "brocadevtm_monitor" "example-monitor-glb" {
  name = "example-glb-monitor"
  back_off = true
  delay = 10
  failures = 6
  machine = "10.2.1.50:80"
  timeout = 8
  type = "http"
}

resource "brocadevtm_glb" "example" {
  name = "example-glb"
  algorithm = "weighted_random"
  all_monitors_needed = true
  auto_recovery = true
  chained_auto_failback = true
  disable_on_failure = true
  enabled = true
  return_ips_on_fail = true
  geo_effect = 75
  ttl = -1
  chained_location_order = [ "${brocadevtm_location.example-one.name}",  "${brocadevtm_location.example-two.name}" ]
  domains = [ "example.com" ]
  last_resort_response = [ "10.2.1.10" ]
  location_draining = [ "${brocadevtm_location.example-two.name}" ]
  location_settings = [
    {
      location = "${brocadevtm_location.example-one.name}"
      weight = 1
      ip_addresses = [ "10.1.1.10" ]
      monitors = [ "${brocadevtm_monitor.example-glb.name}" ]
    },
    {
      location = "${brocadevtm_location.example-two.name}"
      weight = 1
      ip_addresses = [ "10.1.2.10" ]
      monitors = [ "${brocadevtm_monitor.example-glb.name}" ]
    },
  ]
}