tfwriter

Terraform HCL code generator.

Download as .zip Download as .tar.gz View on GitHub

alicloud_slb_server_group

back

Index

Terraform

terraform {
  required_providers {
    alicloud = ">= 1.120.0"
  }
}

top

Example Usage

module "alicloud_slb_server_group" {
  source = "./modules/alicloud/r/alicloud_slb_server_group"

  # delete_protection_validation - (optional) is a type of bool
  delete_protection_validation = null
  # load_balancer_id - (required) is a type of string
  load_balancer_id = null
  # name - (optional) is a type of string
  name = null

  servers = [{
    port       = null
    server_ids = []
    type       = null
    weight     = null
  }]
}

top

Variables

variable "delete_protection_validation" {
  description = "(optional)"
  type        = bool
  default     = null
}

variable "load_balancer_id" {
  description = "(required)"
  type        = string
}

variable "name" {
  description = "(optional)"
  type        = string
  default     = null
}

variable "servers" {
  description = "nested block: NestingSet, min items: 0, max items: 0"
  type = set(object(
    {
      port       = number
      server_ids = list(string)
      type       = string
      weight     = number
    }
  ))
  default = []
}

top

Resource

resource "alicloud_slb_server_group" "this" {
  # delete_protection_validation - (optional) is a type of bool
  delete_protection_validation = var.delete_protection_validation
  # load_balancer_id - (required) is a type of string
  load_balancer_id = var.load_balancer_id
  # name - (optional) is a type of string
  name = var.name

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

}

top

Outputs

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

output "this" {
  value = alicloud_slb_server_group.this
}

top