feat: GatewayLoadBalancer supported with subnet_ids#1288
Open
codyrat wants to merge 3 commits intoterraform-aws-modules:masterfrom
Open
feat: GatewayLoadBalancer supported with subnet_ids#1288codyrat wants to merge 3 commits intoterraform-aws-modules:masterfrom
codyrat wants to merge 3 commits intoterraform-aws-modules:masterfrom
Conversation
added 2 commits
March 11, 2026 17:51
…e with subnet_ids A vpc-endpoint with type Interface is able to be associated with subnet_ids but GatewayLoadBalancer type is ignored.
bryantbiggs
reviewed
Mar 11, 2026
| auto_accept = try(each.value.auto_accept, null) | ||
|
|
||
| security_group_ids = try(each.value.service_type, "Interface") == "Interface" ? length(distinct(concat(local.security_group_ids, lookup(each.value, "security_group_ids", [])))) > 0 ? distinct(concat(local.security_group_ids, lookup(each.value, "security_group_ids", []))) : null : null | ||
| subnet_ids = try(each.value.service_type, "Interface") == "Interface" ? distinct(concat(var.subnet_ids, lookup(each.value, "subnet_ids", []))) : null |
Member
There was a problem hiding this comment.
this can simply be:
Suggested change
| subnet_ids = try(each.value.service_type, "Interface") == "Interface" ? distinct(concat(var.subnet_ids, lookup(each.value, "subnet_ids", []))) : null | |
| subnet_ids = try(each.value.service_type, "Interface") != "Gateway" ? distinct(concat(var.subnet_ids, lookup(each.value, "subnet_ids", []))) : null |
|
This PR has been automatically marked as stale because it has been open 30 days |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
feat: Allow
subnet_idsto be passed forGatewayLoadBalancerendpoint typeThe
subnet_idsargument onaws_vpc_endpointis valid for bothInterfaceandGatewayLoadBalancerendpoint types, but the module currently only passessubnet_idswhenservice_typeisInterface.This PR updates the
modules/vpc-endpoints/main.tfto includeGatewayLoadBalancerin the list of types that receivesubnet_ids:Key behavior:
Interfaceendpoints: unchanged —var.subnet_ids(module-level default) is concatenated with per-endpointsubnet_idsGatewayLoadBalancerendpoints: now receive per-endpointsubnet_ids(module-levelvar.subnet_idsis excluded since GWLB endpoints are AZ-specific and should not inherit the shared default)Gatewayendpoints: unchanged —subnet_idsremainsnullMotivation and Context
GatewayLoadBalancerVPC endpoints must be associated with a subnet in order to function. The AWS provider'saws_vpc_endpointresource acceptssubnet_idsfor this type, but the module's conditional logic is silently settingsubnet_ids = null. This caused GWLB endpoints to be created with no subnet attachment.This is problematic for centralized inspection architectures where GWLB endpoints are created per-AZ in spoke VPCs and each endpoint must be placed in a specific subnet.
Breaking Changes
No breaking changes. The only behavioral difference is that
GatewayLoadBalancerendpoints now correctly receive their per-endpointsubnet_ids. Existing configurations that do not useGatewayLoadBalancerendpoints are completely unaffected. ExistingGatewayLoadBalancerendpoints that did not specifysubnet_idswill continue to receivenull(vialookup(each.value, "subnet_ids", [])).How Has This Been Tested?
examples/*to demonstrate and validate my change(s)examples/*projectsTested by deploying GWLB endpoints in a live AWS environment using this module with the following endpoint configuration:
Before the fix, the endpoints were created but with no subnet association. After the fix, each endpoint is correctly associated with its specified subnet.
pre-commit run -aon my pull request