hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.71k stars 9.07k forks source link

[Enhancement]: add support for enable_primary_ipv6 flag for aws_instance, aws_vpc_network_interface and aws_launch_template #36424

Open arianvp opened 5 months ago

arianvp commented 5 months ago

Description

In order to use IPV6 target groups (#35010 #36423 ) you need to set up your instance with a "Primary IPv6 address". For this you need to set the PrimaryIpv6 boolean on your network interface but the terraform provider doesn't expose this option

Affected Resource(s) and/or Data Source(s)

Potential Terraform Configuration

resource "aws_instance" "web" {
  ami           = data.aws_ami.ubuntu.id
  instance_type = "t3.micro"

  ipv6_address_count = 1
  enable_primary_ipv6  = true

  tags = {
    Name = "HelloWorld"
  }
}

resource "aws_launch_template" "web" {
  name          = "web"
  image_id      = data.aws_ami.nixos.id
  instance_type = "t3.micro"

  network_interfaces {
    ipv6_address_count = 1
    enable_primary_ipv6  = true
  }
}

resource "aws_vpc_network_interface" "test" {
  subnet_id           = aws_subnet.public_a.id
  ipv6_address_count  = 1
  enable_primary_ipv6 = true
}

References

For the aws_vpc_network_interface resource we need to use the EnablePrimaryIpv6 field in CreateNetworkInterface https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateNetworkInterface.html

For the aws_launch_template resource we need to set the PrimaryIpv6 field https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_LaunchTemplateInstanceNetworkInterfaceSpecificationRequest.html

This functionality was announced here: https://aws.amazon.com/about-aws/whats-new/2023/08/amazon-vpc-primary-ipv6-address-elastic-interface/

Would you like to implement a fix?

No

github-actions[bot] commented 5 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

ankon commented 2 months ago

Related/partial duplicate? https://github.com/hashicorp/terraform-provider-aws/issues/34038

pdostal commented 1 month ago

Hello, will be the enable_primary_ipv6 setting available also for aws_instance aws_network_interface? Thank you šŸ™

arianvp commented 1 month ago

Yes https://github.com/hashicorp/terraform-provider-aws/pull/36425 adds support for all those. I'm just waiting for someone to review it