fix: use toset(keys(...)) in vpc-endpoints for_each to avoid deprecated .region schema walk - #170
Open
Arnoldas Brazys (arnoldasbrazys) wants to merge 1 commit into
Conversation
Arnoldas Brazys (arnoldasbrazys)
requested review from
Veronika Gnilitska (gberenice) and
John C. Bland II (johncblandii)
June 23, 2026 11:14
Contributor
|
/terratest |
Contributor
|
Arnoldas Brazys (@arnoldasbrazys) can I ask you to remove the
Thanks! |
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.
what
for_each = ... ? data.aws_vpc_endpoint_service.X : {}withfor_each = ... ? toset(keys(data.aws_vpc_endpoint_service.X)) : toset([])in all fourfor_eachexpressions inmodules/vpc-endpoints/main.tfwhy
for_eachcauses Terraform/OpenTofu to walk the entireaws_vpc_endpoint_serviceschema, which surfaces a deprecation warning for theregionattribute (replaced byservice_regionin AWS provider v6.x):each.value— label modules only referenceeach.key, and endpoint resources access data source attributes directly viadata.aws_vpc_endpoint_service.X[each.key].attr. Usingtoset(keys(...))keeps the same string keys, so state is unaffected and no migration is neededreferences