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.87k stars 9.21k forks source link

[Enhancement]: aws_launch_template network_interfaces block missing primary_ipv6 #33733

Closed johngmyers closed 5 months ago

johngmyers commented 1 year ago

Description

Allow an AWS launch template to specify that a network interface should make an IPv6 address be primary. An instance must have a primary IPv6 address in order to be able to be an instance target of an IPv6 target group.

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

aws_launch_template

Potential Terraform Configuration

resource "aws_launch_template" "nodes-minimal-ipv6-example-com" {
  block_device_mappings {
    device_name = "/dev/xvda"
    ebs {
      delete_on_termination = true
      encrypted             = true
      iops                  = 3000
      throughput            = 125
      volume_size           = 128
      volume_type           = "gp3"
    }
  }
  iam_instance_profile {
    name = aws_iam_instance_profile.nodes-minimal-ipv6-example-com.id
  }
  image_id      = "ami-12345678"
  instance_type = "t3.medium"
  key_name      = aws_key_pair.kubernetes-minimal-ipv6-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
  lifecycle {
    create_before_destroy = true
  }
  metadata_options {
    http_endpoint               = "enabled"
    http_protocol_ipv6          = "enabled"
    http_put_response_hop_limit = 1
    http_tokens                 = "optional"
  }
  monitoring {
    enabled = false
  }
  name = "nodes.minimal-ipv6.example.com"
  network_interfaces {
    associate_public_ip_address = false
    delete_on_termination       = true
    ipv6_address_count          = 1
    primary_ipv6                = true
    security_groups             = [aws_security_group.nodes-minimal-ipv6-example-com.id]
  }
  tag_specifications {
    resource_type = "instance"
    tags = {
      "KubernetesCluster"                                                          = "minimal-ipv6.example.com"
      "Name"                                                                       = "nodes.minimal-ipv6.example.com"
      "aws-node-termination-handler/managed"                                       = ""
      "k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/node" = ""
      "k8s.io/role/node"                                                           = "1"
      "kops.k8s.io/instancegroup"                                                  = "nodes"
      "kubernetes.io/cluster/minimal-ipv6.example.com"                             = "owned"
    }
  }
  tag_specifications {
    resource_type = "volume"
    tags = {
      "KubernetesCluster"                                                          = "minimal-ipv6.example.com"
      "Name"                                                                       = "nodes.minimal-ipv6.example.com"
      "aws-node-termination-handler/managed"                                       = ""
      "k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/node" = ""
      "k8s.io/role/node"                                                           = "1"
      "kops.k8s.io/instancegroup"                                                  = "nodes"
      "kubernetes.io/cluster/minimal-ipv6.example.com"                             = "owned"
    }
  }
  tags = {
    "KubernetesCluster"                                                          = "minimal-ipv6.example.com"
    "Name"                                                                       = "nodes.minimal-ipv6.example.com"
    "aws-node-termination-handler/managed"                                       = ""
    "k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/node" = ""
    "k8s.io/role/node"                                                           = "1"
    "kops.k8s.io/instancegroup"                                                  = "nodes"
    "kubernetes.io/cluster/minimal-ipv6.example.com"                             = "owned"
  }
  user_data = filebase64("${path.module}/data/aws_launch_template_nodes.minimal-ipv6.example.com_user_data")
}

References

https://aws.amazon.com/about-aws/whats-new/2023/08/amazon-vpc-primary-ipv6-address-elastic-interface/

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

oliviassss commented 1 year ago

@johngmyers, thanks for opening this issue. I'm not familiar with terraform, but just wondering do we also need to update the eks-cluster template for the missing field to enable primary ipv6? Or it will respect the value in aws_launch_template https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster

johngmyers commented 1 year ago

@oliviassss This shouldn't affect the aws_eks_cluster resource itself. It's just that the launch template for any node in the cluster will need this setting in order for it to be an instance target of an IPv6 target group. (Or something else would have to promote one of the instance's IPv6 addresses to primary.)

github-actions[bot] commented 5 months ago

[!WARNING] This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

github-actions[bot] commented 4 months ago

This functionality has been released in v5.58.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] commented 3 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.