Sign in
Menu
Start free trial

Use this module

module "global_accelerator" {
  source = "registry.compliance.tf/terraform-aws-modules/global-accelerator/aws"

  name = "example"

  flow_logs_enabled   = true
  flow_logs_s3_bucket = "example-global-accelerator-flow-logs"
  flow_logs_s3_prefix = "example"

  listeners = {
    listener_1 = {
      client_affinity = "SOURCE_IP"

      endpoint_groups = {
        my_group = {
          health_check_port             = 80
          health_check_protocol         = "HTTP"
          health_check_path             = "/"
          health_check_interval_seconds = 10
          health_check_timeout_seconds  = 5
          healthy_threshold_count       = 2
          unhealthy_threshold_count     = 2
          traffic_dial_percentage       = 100

          endpoint_configuration = [{
            client_ip_preservation_enabled = true
            endpoint_id                    = "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/blue/1234567890123456"
            weight                         = 50
          }, {
            client_ip_preservation_enabled = false
            endpoint_id                    = "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/green/1234567890123456"
            weight                         = 50
          }]

          port_override = [{
            endpoint_port = 82
            listener_port = 80
          }, {
            endpoint_port = 8082
            listener_port = 8080
          }, {
            endpoint_port = 8083
            listener_port = 8081
          }]
        }
      }

      port_ranges = [
        {
          from_port = 80
          to_port   = 81
        },
        {
          from_port = 8080
          to_port   = 8081
        }
      ]
      protocol = "TCP"
    }

    listener_2 = {
      port_ranges = [
        {
          from_port = 443
          to_port   = 443
        },
        {
          from_port = 8443
          to_port   = 8443
        }
      ]
      protocol = "TCP"
    }

    listener_3 = {
      port_ranges = [
        {
          from_port = 53
          to_port   = 53
        }
      ]
      protocol = "UDP"
    }
  }

  tags = {
    Terraform   = "true"
    Environment = "dev"
  }
}

The example from the module's README, with this page's source.

Key inputs

Required inputs first, then the inputs the README example sets.

  • namestring, default ""

    The name of the accelerator

  • flow_logs_enabledbool, default false

    Indicates whether flow logs are enabled. Defaults to false

  • flow_logs_s3_bucketstring, default null

    The name of the Amazon S3 bucket for the flow logs. Required if flow_logs_enabled is true

  • flow_logs_s3_prefixstring, default null

    The prefix for the location in the Amazon S3 bucket for the flow logs. Required if flow_logs_enabled is true

  • listenersany, default {}

    A map of listener defintions to create

  • tagsmap(string), default {}

    A map of tags to add to all resources

All 13 inputs