Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Correct for_each map on VPC endpoints to propagate endpoint maps correctly #729

Merged

Conversation

bryantbiggs
Copy link
Member

Description

  • correct for_each map on VPC endpoints to propagate endpoint maps correctly by using the map comprehension. this also solves for the case where create = false and avoiding the Error: Inconsistent conditional result types. The true result value has the wrong type: element types must all match for conversion to map. error
  • update outputs to use new try() and recommended index [0]/[*] syntax

Motivation and Context

Breaking Changes

  • No

How Has This Been Tested?

  • I have tested and validated these changes using one or more of the provided examples/* projects
    - Validated with complete-vpc example; no plan diff from current master

@bryantbiggs bryantbiggs changed the title fix: correct for_each map on VPC endpoints to propagate endpoint maps correctly fix: Correct for_each map on VPC endpoints to propagate endpoint maps correctly Jan 11, 2022
}

output "redshift_route_table_ids" {
description = "List of IDs of redshift route tables"
value = length(aws_route_table.redshift.*.id) > 0 ? aws_route_table.redshift.*.id : (var.enable_public_redshift ? aws_route_table.public.*.id : aws_route_table.private.*.id)
value = try(coalescelist(aws_route_table.redshift[*].id, aws_route_table.public[*].id, aws_route_table.private[*].id), [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try() ❤️

Much more elegant!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elegant but wrong :)
Bug #738

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah shoot, my bad

@antonbabenko
Copy link
Member

Let me know if/when this one is ready for merge.

@bryantbiggs
Copy link
Member Author

@antonbabenko - should be all set, already checked with the complete-vpc example 👍🏽

@antonbabenko antonbabenko merged commit 19fcf0d into terraform-aws-modules:master Jan 11, 2022
antonbabenko pushed a commit that referenced this pull request Jan 11, 2022
### [3.11.2](v3.11.1...v3.11.2) (2022-01-11)

### Bug Fixes

* Correct `for_each` map on VPC endpoints to propagate endpoint maps correctly ([#729](#729)) ([19fcf0d](19fcf0d))
@antonbabenko
Copy link
Member

This PR is included in version 3.11.2 🎉

@bryantbiggs bryantbiggs deleted the fix/vpc-endpoints branch January 11, 2022 20:40
harrythebot pushed a commit to lolocompany/terraform-aws-vpc that referenced this pull request May 11, 2022
harrythebot pushed a commit to lolocompany/terraform-aws-vpc that referenced this pull request May 11, 2022
### [3.11.2](terraform-aws-modules/terraform-aws-vpc@v3.11.1...v3.11.2) (2022-01-11)

### Bug Fixes

* Correct `for_each` map on VPC endpoints to propagate endpoint maps correctly ([terraform-aws-modules#729](terraform-aws-modules#729)) ([19fcf0d](terraform-aws-modules@19fcf0d))
@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VPC endpoints module fails if a dynamodb block is added
2 participants