Terraform module for AWS Target Group
This is a stable example. It should successfully build out of the box
This module may be used to create Target Group resources in AWS cloud provider....
This module needs Terraform 0.12.16 or newer. You can download the latest Terraform version from here.
This module deploys aws services details are in respective feature branches.
Below we are able to check the resources that are being created as part of this module call:
- Target Group
To use this module, add the following call to your code:
module "alb_tg" {
source = "git::https://github.com/nitinda/terraform-module-aws-lb-tg.git?ref=terraform-12/target-ip-instance"
# Providers
providers = {
aws = aws.services
}
# Tags
tags = {
Description = "Load balancer Target Group"
ManagedBy = "Terraform"
Project = "POC"
Environment = "prod"
}
# ALB Target Group
name = var.target_group_name
port = var.target_group_port
protocol = var.target_group_protocol
vpc_id = var.vpc_id
target_type = var.target_group_type
health_check = [
{
healthy_threshold = 2
unhealthy_threshold = 2
interval = 5
matcher = "200"
path = "/"
port = "traffic-port"
protocol = "HTTP"
timeout = 3
}
]
}
The variables required in order for the module to be successfully called from the deployment repository are the following:
Variable | Description | Type | Argument Status | Default Value |
---|---|---|---|---|
name | The name of the target group, Forces new resource | string | Optional | null |
name_prefix | Creates a unique name beginning with the specified prefix. Forces new resource | string | Optional | null |
port | The port on which targets receive traffic, unless overridden when registering a specific target.Forces new resource. Required when target_type is instance or ip |
number | Optional | null |
protocol | The protocol to use for routing traffic to the targets. Should be one of "TCP", "TLS", "UDP", "TCP_UDP", "HTTP" or "HTTPS". Required when target_type is instance or ip. Does not apply when target_type is lambda. | number | Optional | null |
vpc_id | The identifier of the VPC in which to create the target group. Required when target_type is instance or ip. Does not apply when target_type is lambda. | string | Optional | null |
deregistration_delay | The amount time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds. | number | Optional | 300 |
load_balancing_algorithm_type | Determines how the load balancer selects targets when routing requests. Only applicable for Application Load Balancer Target Groups. The value is round_robin or least_outstanding_requests. The default is round_robin. | string | Optional | round_robin |
lambda_multi_value_headers_enabled | Boolean whether the request and response headers exchanged between the load balancer and the Lambda function include arrays of values or strings. Only applies when target_type is lambda. | boolean | Optional | null |
proxy_protocol_v2 | Boolean to enable / disable support for proxy protocol v2 on Network Load Balancers. | any | Optional | null |
stickiness | A Stickiness block. Stickiness blocks are documented below. stickiness is only valid if used with Load Balancers of type Application | map(string) | Optional | {} |
health_check | A Health Check block | map(string) | Optional | {} |
target_type | The type of target that you must specify when registering targets with this target group. | string | Optional | {} |
tags | A mapping of tags to assign to the resource | map(string) | Optional | {} |
- id
- arn
- name
- arn_suffix
The output variable is able to be accessed through terraform state file using the syntax below:
data.terraform_remote_state.<module_name>.<output_variable_name>
Module maintained by Module maintained by the - Nitin Das