Skip to content

Latest commit

 

History

History
222 lines (185 loc) · 5.04 KB

gridscale_loadbalancer.md

File metadata and controls

222 lines (185 loc) · 5.04 KB

gridscale_loadbalancer

back

Index

Terraform

terraform {
  required_providers {
    gridscale = ">= 1.8.4"
  }
}

top

Example Usage

module "gridscale_loadbalancer" {
  source = "./modules/gridscale/r/gridscale_loadbalancer"

  # algorithm - (required) is a type of string
  algorithm = null
  # labels - (optional) is a type of set of string
  labels = []
  # listen_ipv4_uuid - (required) is a type of string
  listen_ipv4_uuid = null
  # listen_ipv6_uuid - (required) is a type of string
  listen_ipv6_uuid = null
  # name - (required) is a type of string
  name = null
  # redirect_http_to_https - (required) is a type of bool
  redirect_http_to_https = null
  # status - (optional) is a type of string
  status = null

  backend_server = [{
    host   = null
    weight = null
  }]

  forwarding_rule = [{
    letsencrypt_ssl = null
    listen_port     = null
    mode            = null
    target_port     = null
  }]

  timeouts = [{
    create = null
    delete = null
    update = null
  }]
}

top

Variables

variable "algorithm" {
  description = "(required) - The algorithm used to process requests. Accepted values: roundrobin/leastconn."
  type        = string
}

variable "labels" {
  description = "(optional) - List of labels."
  type        = set(string)
  default     = null
}

variable "listen_ipv4_uuid" {
  description = "(required) - The UUID of the IPv4 address the Load balancer will listen to for incoming requests."
  type        = string
}

variable "listen_ipv6_uuid" {
  description = "(required) - The UUID of the IPv6 address the Load balancer will listen to for incoming requests."
  type        = string
}

variable "name" {
  description = "(required) - The human-readable name of the object. It supports the full UTF-8 character set, with a maximum of 64 characters"
  type        = string
}

variable "redirect_http_to_https" {
  description = "(required) - Whether the Load balancer is forced to redirect requests from HTTP to HTTPS"
  type        = bool
}

variable "status" {
  description = "(optional) - Status indicates the status of the object."
  type        = string
  default     = null
}

variable "backend_server" {
  description = "nested block: NestingSet, min items: 1, max items: 0"
  type = set(object(
    {
      host   = string
      weight = number
    }
  ))
}

variable "forwarding_rule" {
  description = "nested block: NestingSet, min items: 1, max items: 0"
  type = set(object(
    {
      letsencrypt_ssl = string
      listen_port     = number
      mode            = string
      target_port     = number
    }
  ))
}

variable "timeouts" {
  description = "nested block: NestingSingle, min items: 0, max items: 0"
  type = set(object(
    {
      create = string
      delete = string
      update = string
    }
  ))
  default = []
}

top

Resource

resource "gridscale_loadbalancer" "this" {
  # algorithm - (required) is a type of string
  algorithm = var.algorithm
  # labels - (optional) is a type of set of string
  labels = var.labels
  # listen_ipv4_uuid - (required) is a type of string
  listen_ipv4_uuid = var.listen_ipv4_uuid
  # listen_ipv6_uuid - (required) is a type of string
  listen_ipv6_uuid = var.listen_ipv6_uuid
  # name - (required) is a type of string
  name = var.name
  # redirect_http_to_https - (required) is a type of bool
  redirect_http_to_https = var.redirect_http_to_https
  # status - (optional) is a type of string
  status = var.status

  dynamic "backend_server" {
    for_each = var.backend_server
    content {
      # host - (required) is a type of string
      host = backend_server.value["host"]
      # weight - (optional) is a type of number
      weight = backend_server.value["weight"]
    }
  }

  dynamic "forwarding_rule" {
    for_each = var.forwarding_rule
    content {
      # letsencrypt_ssl - (optional) is a type of string
      letsencrypt_ssl = forwarding_rule.value["letsencrypt_ssl"]
      # listen_port - (required) is a type of number
      listen_port = forwarding_rule.value["listen_port"]
      # mode - (required) is a type of string
      mode = forwarding_rule.value["mode"]
      # target_port - (required) is a type of number
      target_port = forwarding_rule.value["target_port"]
    }
  }

  dynamic "timeouts" {
    for_each = var.timeouts
    content {
      # create - (optional) is a type of string
      create = timeouts.value["create"]
      # delete - (optional) is a type of string
      delete = timeouts.value["delete"]
      # update - (optional) is a type of string
      update = timeouts.value["update"]
    }
  }

}

top

Outputs

output "id" {
  description = "returns a string"
  value       = gridscale_loadbalancer.this.id
}

output "location_uuid" {
  description = "returns a string"
  value       = gridscale_loadbalancer.this.location_uuid
}

output "this" {
  value = gridscale_loadbalancer.this
}

top