Skip to content

Commit bc5ad7c

Browse files
authored
feat: Introduce IPv6 CIDR specific allow ALBs variables (#275)
1 parent fab764c commit bc5ad7c

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,14 @@ allow_github_webhooks = true
228228
| Name | Version |
229229
|------|---------|
230230
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
231-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.45 |
231+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.45 |
232232
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |
233233

234234
## Providers
235235

236236
| Name | Version |
237237
|------|---------|
238-
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.45 |
238+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.45 |
239239
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |
240240

241241
## Modules
@@ -295,6 +295,7 @@ allow_github_webhooks = true
295295
| <a name="input_alb_http_security_group_tags"></a> [alb\_http\_security\_group\_tags](#input\_alb\_http\_security\_group\_tags) | Additional tags to put on the http security group | `map(string)` | `{}` | no |
296296
| <a name="input_alb_https_security_group_tags"></a> [alb\_https\_security\_group\_tags](#input\_alb\_https\_security\_group\_tags) | Additional tags to put on the https security group | `map(string)` | `{}` | no |
297297
| <a name="input_alb_ingress_cidr_blocks"></a> [alb\_ingress\_cidr\_blocks](#input\_alb\_ingress\_cidr\_blocks) | List of IPv4 CIDR ranges to use on all ingress rules of the ALB. | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
298+
| <a name="input_alb_ingress_ipv6_cidr_blocks"></a> [alb\_ingress\_ipv6\_cidr\_blocks](#input\_alb\_ingress\_ipv6\_cidr\_blocks) | List of IPv6 CIDR ranges to use on all ingress rules of the ALB. | `list(string)` | <pre>[<br> "::/0"<br>]</pre> | no |
298299
| <a name="input_alb_ip_address_type"></a> [alb\_ip\_address\_type](#input\_alb\_ip\_address\_type) | The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 and dualstack | `string` | `"ipv4"` | no |
299300
| <a name="input_alb_listener_ssl_policy_default"></a> [alb\_listener\_ssl\_policy\_default](#input\_alb\_listener\_ssl\_policy\_default) | The security policy if using HTTPS externally on the load balancer. [See](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html). | `string` | `"ELBSecurityPolicy-2016-08"` | no |
300301
| <a name="input_alb_log_bucket_name"></a> [alb\_log\_bucket\_name](#input\_alb\_log\_bucket\_name) | S3 bucket (externally created) for storing load balancer access logs. Required if alb\_logging\_enabled is true. | `string` | `""` | no |
@@ -365,7 +366,8 @@ allow_github_webhooks = true
365366
| <a name="input_extra_container_definitions"></a> [extra\_container\_definitions](#input\_extra\_container\_definitions) | A list of valid container definitions provided as a single valid JSON document. These will be provided as supplimentary to the main Atlantis container definition | `list(any)` | `[]` | no |
366367
| <a name="input_extra_load_balancers"></a> [extra\_load\_balancers](#input\_extra\_load\_balancers) | A list of maps for additional ECS task load balancers | `list(map(string))` | `[]` | no |
367368
| <a name="input_firelens_configuration"></a> [firelens\_configuration](#input\_firelens\_configuration) | The FireLens configuration for the container. This is used to specify and configure a log router for container logs. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FirelensConfiguration.html | <pre>object({<br> type = string<br> options = map(string)<br> })</pre> | `null` | no |
368-
| <a name="input_github_webhooks_cidr_blocks"></a> [github\_webhooks\_cidr\_blocks](#input\_github\_webhooks\_cidr\_blocks) | List of CIDR blocks used by GitHub webhooks | `list(string)` | <pre>[<br> "140.82.112.0/20",<br> "185.199.108.0/22",<br> "192.30.252.0/22",<br> "143.55.64.0/20"<br>]</pre> | no |
369+
| <a name="input_github_webhooks_cidr_blocks"></a> [github\_webhooks\_cidr\_blocks](#input\_github\_webhooks\_cidr\_blocks) | List of IPv4 CIDR blocks used by GitHub webhooks | `list(string)` | <pre>[<br> "140.82.112.0/20",<br> "185.199.108.0/22",<br> "192.30.252.0/22",<br> "143.55.64.0/20"<br>]</pre> | no |
370+
| <a name="input_github_webhooks_ipv6_cidr_blocks"></a> [github\_webhooks\_ipv6\_cidr\_blocks](#input\_github\_webhooks\_ipv6\_cidr\_blocks) | List of IPv6 CIDR blocks used by GitHub webhooks | `list(string)` | <pre>[<br> "2a0a:a440::/29",<br> "2606:50c0::/32"<br>]</pre> | no |
369371
| <a name="input_internal"></a> [internal](#input\_internal) | Whether the load balancer is internal or external | `bool` | `false` | no |
370372
| <a name="input_manage_default_security_group"></a> [manage\_default\_security\_group](#input\_manage\_default\_security\_group) | Should be true to adopt and manage default security group | `bool` | `false` | no |
371373
| <a name="input_mount_points"></a> [mount\_points](#input\_mount\_points) | Container mount points. This is a list of maps, where each map should contain a `containerPath` and `sourceVolume`. The `readOnly` key is optional. | `list(any)` | `[]` | no |

main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ module "alb_https_sg" {
331331
vpc_id = local.vpc_id
332332
description = "Security group with HTTPS ports open for specific IPv4 CIDR block (or everybody), egress ports are all world open"
333333

334-
ingress_cidr_blocks = sort(compact(concat(var.allow_github_webhooks ? var.github_webhooks_cidr_blocks : [], var.alb_ingress_cidr_blocks)))
334+
ingress_cidr_blocks = sort(compact(concat(var.allow_github_webhooks ? var.github_webhooks_cidr_blocks : [], var.alb_ingress_cidr_blocks)))
335+
ingress_ipv6_cidr_blocks = sort(compact(concat(var.allow_github_webhooks ? var.github_webhooks_ipv6_cidr_blocks : [], var.alb_ingress_ipv6_cidr_blocks)))
335336

336337
tags = merge(local.tags, var.alb_https_security_group_tags)
337338
}
@@ -344,7 +345,8 @@ module "alb_http_sg" {
344345
vpc_id = local.vpc_id
345346
description = "Security group with HTTP ports open for specific IPv4 CIDR block (or everybody), egress ports are all world open"
346347

347-
ingress_cidr_blocks = sort(compact(concat(var.allow_github_webhooks ? var.github_webhooks_cidr_blocks : [], var.alb_ingress_cidr_blocks)))
348+
ingress_cidr_blocks = sort(compact(concat(var.allow_github_webhooks ? var.github_webhooks_cidr_blocks : [], var.alb_ingress_cidr_blocks)))
349+
ingress_ipv6_cidr_blocks = sort(compact(concat(var.allow_github_webhooks ? var.github_webhooks_ipv6_cidr_blocks : [], var.alb_ingress_ipv6_cidr_blocks)))
348350

349351
tags = merge(local.tags, var.alb_http_security_group_tags)
350352
}

variables.tf

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ variable "alb_ingress_cidr_blocks" {
108108
default = ["0.0.0.0/0"]
109109
}
110110

111+
variable "alb_ingress_ipv6_cidr_blocks" {
112+
description = "List of IPv6 CIDR ranges to use on all ingress rules of the ALB."
113+
type = list(string)
114+
default = ["::/0"]
115+
}
116+
111117
variable "alb_log_bucket_name" {
112118
description = "S3 bucket (externally created) for storing load balancer access logs. Required if alb_logging_enabled is true."
113119
type = string
@@ -175,11 +181,17 @@ variable "allow_github_webhooks" {
175181
}
176182

177183
variable "github_webhooks_cidr_blocks" {
178-
description = "List of CIDR blocks used by GitHub webhooks" # This is hardcoded to avoid dependency on github provider. Source: https://api.github.com/meta
184+
description = "List of IPv4 CIDR blocks used by GitHub webhooks" # This is hardcoded to avoid dependency on github provider. Source: https://api.github.com/meta
179185
type = list(string)
180186
default = ["140.82.112.0/20", "185.199.108.0/22", "192.30.252.0/22", "143.55.64.0/20"]
181187
}
182188

189+
variable "github_webhooks_ipv6_cidr_blocks" {
190+
description = "List of IPv6 CIDR blocks used by GitHub webhooks" # This is hardcoded to avoid dependency on github provider. Source: https://api.github.com/meta
191+
type = list(string)
192+
default = ["2a0a:a440::/29", "2606:50c0::/32"]
193+
}
194+
183195
variable "whitelist_unauthenticated_cidr_blocks" {
184196
description = "List of allowed CIDR blocks to bypass authentication"
185197
type = list(string)

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 = "~> 3.45"
7+
version = ">= 3.45"
88
}
99

1010
random = {

0 commit comments

Comments
 (0)