Skip to content

Commit 841c083

Browse files
committed
refactor(alb): extract enable_deletion_protection to a variable with default value set to false
1 parent fb5e715 commit 841c083

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

modules/alb/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ No modules.
2929

3030
| Name | Description | Type | Default | Required |
3131
|------|-------------|------|---------|:--------:|
32+
| <a name="input_enable_deletion_protection"></a> [enable\_deletion\_protection](#input\_enable\_deletion\_protection) | If true, deletion of the load balancer will be disabled via the AWS API. This will prevent Terraform from deleting the load balancer | `bool` | `false` | no |
3233
| <a name="input_internal"></a> [internal](#input\_internal) | Either the ALB is internal or internet-facing | `bool` | `false` | no |
3334
| <a name="input_listeners"></a> [listeners](#input\_listeners) | Listeners to forward ALB ingress to desired Target Groups | <pre>map(object({<br> default_action = list(object({<br> type = string<br> target_group = string<br> authenticate_cognito = optional(any, {})<br> authenticate_oidc = optional(any, {})<br> fixed_response = optional(any, {})<br> forward = optional(any, {})<br> order = optional(number)<br> redirect = optional(any, {})<br> }))<br> alpn_policy = optional(string)<br> certificate_arn = optional(string)<br> mutual_authentication = optional(any, {})<br> port = optional(number)<br> protocol = optional(string)<br> ssl_policy = optional(string)<br> tags = optional(map(any), {})<br> }))</pre> | n/a | yes |
3435
| <a name="input_name"></a> [name](#input\_name) | Name of the ALB | `string` | `""` | no |

modules/alb/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ resource "aws_lb" "this" {
1212

1313
preserve_host_header = var.preserve_host_header
1414

15-
enable_deletion_protection = false
15+
enable_deletion_protection = var.enable_deletion_protection
1616

1717
tags = var.tags
1818
}

modules/alb/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ variable "preserve_host_header" {
3131
default = false
3232
}
3333

34+
variable "enable_deletion_protection" {
35+
description = "If true, deletion of the load balancer will be disabled via the AWS API. This will prevent Terraform from deleting the load balancer"
36+
type = bool
37+
default = false
38+
}
39+
3440
variable "tags" {
3541
description = "Resource Tags for the ALB"
3642
type = map(any)

0 commit comments

Comments
 (0)