Skip to content

[Enhancement]: Support NLB subnet removal #41418

@bobsut

Description

@bobsut

Description

The aws_lb resource says:

  • subnet_mapping - (Optional) Subnet mapping block. See below. For Load Balancers of type network subnet mappings can only be added.
  • subnets - (Optional) List of subnet IDs to attach to the LB. For Load Balancers of type network subnets can only be added (see Availability Zones), deleting a subnet for load balancers of type network will force a recreation of the resource.

The Networking & Content Delivery blog (13 Feb 2025) Exploring new subnet management capabilities of Network Load Balancer says:

NLBs now support full subnet management, including removal of subnets, matching the capabilities of Application Load Balancer (ALB) ... The introduction of the ability to remove subnets using the SetSubnets API changes subnet management for NLBs. This new capability enables you to modify subnet configurations after deployment, allowing you to relocate your load balancer to any desired subnet within your Amazon Virtual Private Cloud (Amazon VPC).

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

Potential Terraform Configuration

resource "aws_lb" "this" {
  name               = "this-nlb"
  internal           = false
  load_balancer_type = "network"
  subnets            = [for subnet in aws_subnet.public : subnet.id]
}

References

Update Availability Zones
SetSubnet API

Would you like to implement a fix?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequests to existing resources that expand the functionality or scope.service/elbv2Issues and PRs that pertain to the elbv2 service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions