Giter VIP home page Giter VIP logo

terraform-google-lb's Introduction

Regional TCP Load Balancer Terraform Module

Modular Regional TCP Load Balancer for GCE using target pool and forwarding rule.

Load Balancer Types

Compatibility

This module is meant for use with Terraform 0.13. If you haven't upgraded and need a Terraform 0.12.x-compatible version of this module, the last released version intended for Terraform 0.12.x is v2.3.0.

Usage

Basic usage is as follows:

module "load_balancer" {
  source       = "GoogleCloudPlatform/lb/google"
  version      = "~> 2.0.0"
  region       = var.region
  name         = "load-balancer"
  service_port = 80
  target_tags  = ["allow-lb-service"]
  network      = var.network
}

module "managed_instance_group" {
  source            = "terraform-google-modules/vm/google//modules/mig"
  version           = "~> 1.0.0"
  region            = var.region
  target_size       = 2
  hostname          = "mig-simple"
  instance_template = module.instance_template.self_link
  target_pools      = [module.load_balancer.target_pool]
  named_ports = [{
    name = "http"
    port = 80
  }]
}

Full functional examples are located in the examples directory.

Resources Created

Figure 1. Diagram of Terraform resources created by module (in green). Terraform Resources Diagram

Inputs

Name Description Type Default Required
allowed_ips The IP address ranges which can access the load balancer. list(string)
[
"0.0.0.0/0"
]
no
disable_health_check Disables the health check on the target pool. bool false no
firewall_project Name of the project to create the firewall rule in. Useful for shared VPC. Default is var.project. string "" no
health_check Health check to determine whether instances are responsive and able to do work
object({
check_interval_sec = number
healthy_threshold = number
timeout_sec = number
unhealthy_threshold = number
port = number
request_path = string
host = string
})
{
"check_interval_sec": null,
"healthy_threshold": null,
"host": null,
"port": null,
"request_path": null,
"timeout_sec": null,
"unhealthy_threshold": null
}
no
ip_address IP address of the external load balancer, if empty one will be assigned. any null no
ip_protocol The IP protocol for the frontend forwarding rule and firewall rule. TCP, UDP, ESP, AH, SCTP or ICMP. string "TCP" no
name Name for the forwarding rule and prefix for supporting resources. string n/a yes
network Name of the network to create resources in. string "default" no
project The project to deploy to, if not set the default provider project is used. string "" no
region Region used for GCP resources. string n/a yes
service_port TCP port your service is listening on. number n/a yes
session_affinity How to distribute load. Options are NONE, CLIENT_IP and CLIENT_IP_PROTO string "NONE" no
target_service_accounts List of target service accounts to allow traffic using firewall rule. list(string) null no
target_tags List of target tags to allow traffic using firewall rule. list(string) null no

Outputs

Name Description
external_ip The external ip address of the forwarding rule.
target_pool The self_link to the target pool resource created.

health_check variable

The health_check variable values are passed on to the google_compute_http_health_check resource. Setting values to null will use google_compute_http_health_check defaults. It takes the following parameters:

Name Description Default Requirement
check_interval_sec How often (in seconds) to send a health check 5 no
healthy_threshold A so-far unhealthy instance will be marked healthy after this many consecutive successes 2 no
host The value of the host header in the HTTP health check request "" no
port The TCP port number for the HTTP health check request 80 no
request_path The request path of the HTTP health check request / no
timeout_sec How long (in seconds) to wait before claiming failure 5 no
unhealthy_threshold A so-far healthy instance will be marked unhealthy after this many consecutive failures 2 no

terraform-google-lb's People

Contributors

danisla avatar taylorludwig avatar aaron-lane avatar morgante avatar zefdelgadillo avatar release-please[bot] avatar yuvraj2987 avatar nick4fake avatar ingwarr avatar kumar-dhanagopal avatar rosbo avatar cloud-foundation-bot avatar enm10k avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.