Open aslatter opened 6 months ago
Voting for Prioritization
Volunteering to Work on This Issue
I'm experiencing the same limitation: I'm not able to create target groups of target_type instance
with ip_address_type ipv6
using Terraform, while I can through the AWS console.
In my case I'm creating the target groups through the AWS ALB module but the behaviour is the same. This is a snippet of one of the target groups:
target_groups = {
target_http = {
name_prefix = "http-"
protocol = "TCP"
port = 80
target_type = "instance"
ip_address_type = "ipv6"
vpc_id = data.terraform_remote_state.vpc.outputs.vpc_id
health_check = {
enabled = true
protocol = "TCP"
}
create_attachment = false
}
...
}
The target groups get actually created in ipv4
mode (see screenshot below) and every new terraform plan will show the target groups are going to be re-created.
module.ingress_nlb.aws_lb_target_group.this["http"] must be replaced
+/- resource "aws_lb_target_group" "this" {
~ ip_address_type = "ipv4" -> "ipv6" # forces replacement
Reading the aws_lb_target_group
resource documentation it says this attribute is only supported when target_type
is set to ip
.
I wonder if there is a temporary workaround for this.
Is there any plan to work on this? AWS started charging for IPv4 and it's not psosible to create an autoscaling group with an IPv6 target group at the moment which is rather annoying
Even if this would work; it's currently not possible to create an EC2 instance that is compatible with IPv6 target groups.
You can only add EC2 instances to an IPv6 target group that have a Primary IPV6 address. This feature is not implemented in Terraform. I opened a separate issue for that:
https://github.com/hashicorp/terraform-provider-aws/issues/36424
Terraform Core Version
1.6.6
AWS Provider Version
5.31.0
Affected Resource(s)
Expected Behavior
When I create a target-group with a target-type of "instance" and ip-address-type of "ipv6", the target-group should get created with an ip-address-type of "ipv6" (or there should be an error).
Actual Behavior
The target group gets created with an ip-address-type of "ipv4".
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
main.tf:
Lockfile:
Steps to Reproduce
Run
terraform apply
twice.The first invocation will succeed, but the second invocation will re-create the target-group because it's ip-address-type is "ipv4" not "ipv6". This re-creation will happen during every apply.
Debug Output
In the trace of the provider it looks like we're not specifying the ip-address-type in the CreateTargetGroup API-call:
Panic Output
No response
Important Factoids
It might be related to this bit in
target_group.go
:That is, we only apply the
ip_address_type
argument for target-groups with an "ip" target-type.The REST API docs for ELB doesn't mention this as a restriction of the
IpAddressType
argument, and the AWS Console seems to allow me to create an "instance" target-group as "ipv6".References
No response
Would you like to implement a fix?
None