Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit ce14f23

Browse files
bodgitMao-hsiang Lien
authored and
Mao-hsiang Lien
committed
feat: Add IPv6 support (ALB and Route53 AAAA record) (terraform-aws-modules#256)
1 parent 2dad502 commit ce14f23

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ allow_github_webhooks = true
270270
| [aws_lb_listener_rule.unauthenticated_access_for_cidr_blocks](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule) | resource |
271271
| [aws_lb_listener_rule.unauthenticated_access_for_webhook](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule) | resource |
272272
| [aws_route53_record.atlantis](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
273+
| [aws_route53_record.atlantis_aaaa](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
273274
| [aws_ssm_parameter.atlantis_bitbucket_user_token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter) | resource |
274275
| [aws_ssm_parameter.atlantis_github_user_token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter) | resource |
275276
| [aws_ssm_parameter.atlantis_gitlab_user_token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter) | resource |
@@ -297,7 +298,8 @@ allow_github_webhooks = true
297298
| <a name="input_alb_enable_deletion_protection"></a> [alb\_enable\_deletion\_protection](#input\_alb\_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. Defaults to false. | `bool` | `null` | no |
298299
| <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 |
299300
| <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 |
300-
| <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)` | `[]` | no |
301+
| <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 |
302+
| <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 |
301303
| <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 |
302304
| <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 |
303305
| <a name="input_alb_log_location_prefix"></a> [alb\_log\_location\_prefix](#input\_alb\_log\_location\_prefix) | S3 prefix within the log\_bucket\_name under which logs are stored. | `string` | `""` | no |
@@ -340,7 +342,8 @@ allow_github_webhooks = true
340342
| <a name="input_container_memory"></a> [container\_memory](#input\_container\_memory) | The amount (in MiB) of memory used by the atlantis container. If not specified ecs\_task\_memory will be used | `number` | `null` | no |
341343
| <a name="input_container_memory_reservation"></a> [container\_memory\_reservation](#input\_container\_memory\_reservation) | The amount of memory (in MiB) to reserve for the container | `number` | `128` | no |
342344
| <a name="input_create_ecs_cluster"></a> [create\_ecs\_cluster](#input\_create\_ecs\_cluster) | Whether to create an ECS cluster or not | `bool` | `true` | no |
343-
| <a name="input_create_route53_record"></a> [create\_route53\_record](#input\_create\_route53\_record) | Whether to create Route53 record for Atlantis | `bool` | `true` | no |
345+
| <a name="input_create_route53_aaaa_record"></a> [create\_route53\_aaaa\_record](#input\_create\_route53\_aaaa\_record) | Whether to create Route53 AAAA record for Atlantis | `bool` | `false` | no |
346+
| <a name="input_create_route53_record"></a> [create\_route53\_record](#input\_create\_route53\_record) | Whether to create Route53 A record for Atlantis | `bool` | `true` | no |
344347
| <a name="input_custom_container_definitions"></a> [custom\_container\_definitions](#input\_custom\_container\_definitions) | A list of valid container definitions provided as a single valid JSON document. By default, the standard container definition is used. | `string` | `""` | no |
345348
| <a name="input_custom_environment_secrets"></a> [custom\_environment\_secrets](#input\_custom\_environment\_secrets) | List of additional secrets the container will use (list should contain maps with `name` and `valueFrom`) | <pre>list(object(<br> {<br> name = string<br> valueFrom = string<br> }<br> ))</pre> | `[]` | no |
346349
| <a name="input_custom_environment_variables"></a> [custom\_environment\_variables](#input\_custom\_environment\_variables) | List of additional environment variables the container will use (list should contain maps with `name` and `value`) | <pre>list(object(<br> {<br> name = string<br> value = string<br> }<br> ))</pre> | `[]` | no |

main.tf

+18-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ data "aws_partition" "current" {}
135135
data "aws_region" "current" {}
136136

137137
data "aws_route53_zone" "this" {
138-
count = var.create_route53_record ? 1 : 0
138+
count = var.create_route53_record || var.create_route53_aaaa_record ? 1 : 0
139139

140140
name = var.route53_zone_name
141141
private_zone = var.route53_private_zone
@@ -251,6 +251,8 @@ module "alb" {
251251
prefix = var.alb_log_location_prefix
252252
}
253253

254+
ip_address_type = var.alb_ip_address_type
255+
254256
enable_deletion_protection = var.alb_enable_deletion_protection
255257

256258
drop_invalid_header_fields = var.alb_drop_invalid_header_fields
@@ -438,7 +440,7 @@ module "acm" {
438440
}
439441

440442
################################################################################
441-
# Route53 record
443+
# Route53 records
442444
################################################################################
443445
resource "aws_route53_record" "atlantis" {
444446
count = var.create_route53_record ? 1 : 0
@@ -454,6 +456,20 @@ resource "aws_route53_record" "atlantis" {
454456
}
455457
}
456458

459+
resource "aws_route53_record" "atlantis_aaaa" {
460+
count = var.create_route53_aaaa_record ? 1 : 0
461+
462+
zone_id = data.aws_route53_zone.this[0].zone_id
463+
name = var.route53_record_name != null ? var.route53_record_name : var.name
464+
type = "AAAA"
465+
466+
alias {
467+
name = module.alb.lb_dns_name
468+
zone_id = module.alb.lb_zone_id
469+
evaluate_target_health = true
470+
}
471+
}
472+
457473
################################################################################
458474
# EFS
459475
################################################################################

variables.tf

+12-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ variable "route53_private_zone" {
237237
}
238238

239239
variable "create_route53_record" {
240-
description = "Whether to create Route53 record for Atlantis"
240+
description = "Whether to create Route53 A record for Atlantis"
241241
type = bool
242242
default = true
243243
}
@@ -706,3 +706,14 @@ variable "allowed_assume_resources" {
706706
type = list(string)
707707
default = []
708708
}
709+
variable "alb_ip_address_type" {
710+
description = "The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 and dualstack"
711+
type = string
712+
default = "ipv4"
713+
}
714+
715+
variable "create_route53_aaaa_record" {
716+
description = "Whether to create Route53 AAAA record for Atlantis"
717+
type = bool
718+
default = false
719+
}

0 commit comments

Comments
 (0)