Skip to content

Commit 2e03f5c

Browse files
authored
Add support loadbalancer capacity reservation (#201)
* support loadbalancer capacity reservation * fix fmt
1 parent f943deb commit 2e03f5c

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ module "alb" {
157157
| Name | Version |
158158
|------|---------|
159159
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
160-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.46 |
160+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.99 |
161161

162162
## Providers
163163

164164
| Name | Version |
165165
|------|---------|
166-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.46 |
166+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.99 |
167167

168168
## Modules
169169

@@ -263,6 +263,7 @@ module "alb" {
263263
| <a name="input_noncurrent_version_transition_days"></a> [noncurrent\_version\_transition\_days](#input\_noncurrent\_version\_transition\_days) | (Deprecated, use `lifecycle_configuration_rules` instead)<br/>Specifies (in days) when noncurrent object versions transition to Glacier Flexible Retrieval | `number` | `30` | no |
264264
| <a name="input_preserve_host_header"></a> [preserve\_host\_header](#input\_preserve\_host\_header) | Indicates whether the Application Load Balancer should preserve the Host header in the HTTP request and send it to the target without any change. | `bool` | `false` | no |
265265
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br/>Characters matching the regex will be removed from the ID elements.<br/>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
266+
| <a name="input_reserved_capacity_units"></a> [reserved\_capacity\_units](#input\_reserved\_capacity\_units) | The number of capacity units reserved for the load balancer | `number` | `null` | no |
266267
| <a name="input_security_group_enabled"></a> [security\_group\_enabled](#input\_security\_group\_enabled) | Enables the security group | `bool` | `true` | no |
267268
| <a name="input_security_group_ids"></a> [security\_group\_ids](#input\_security\_group\_ids) | A list of additional security group IDs to attach to the ALB | `list(string)` | `[]` | no |
268269
| <a name="input_slow_start"></a> [slow\_start](#input\_slow\_start) | The amount of time (30-900 seconds) until a healthy target receives its full share of requests from the load balancer. 0 to disable. | `number` | `null` | no |

main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ resource "aws_lb" "default" {
128128
prefix = var.access_logs_prefix
129129
enabled = var.access_logs_enabled
130130
}
131+
132+
dynamic "minimum_load_balancer_capacity" {
133+
for_each = var.reserved_capacity_units == null ? [] : [var.reserved_capacity_units]
134+
content {
135+
capacity_units = minimum_load_balancer_capacity.value
136+
}
137+
}
131138
}
132139

133140
module "default_target_group_label" {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,3 +426,9 @@ variable "client_keep_alive" {
426426
default = 3600
427427
description = "Client keep alive value in seconds. The valid range is 60-604800 seconds. The default is 3600 seconds."
428428
}
429+
430+
variable "reserved_capacity_units" {
431+
type = number
432+
default = null
433+
description = "The number of capacity units reserved for the load balancer"
434+
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.46"
7+
version = ">= 5.99"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)