Skip to content

Commit

Permalink
fix: Ensure database route table output works (#926)
Browse files Browse the repository at this point in the history
* fix: ensure database route table output works

On initial plan the `database_route_table_ids` output is not
available due to the values not being known until after apply.
Switching the logic to test the length of the array fixes this
issue. Credit to @martin566 for discovering the solution.

fixes #857

* Update outputs.tf

* Update outputs.tf

---------

Co-authored-by: Bryant Biggs <bryantbiggs@gmail.com>
  • Loading branch information
henworth and bryantbiggs committed Jul 25, 2023
1 parent b588428 commit e4c48d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ output "database_subnet_group_name" {

output "database_route_table_ids" {
description = "List of IDs of database route tables"
value = try(coalescelist(aws_route_table.database[*].id, local.private_route_table_ids), [])
# Refer to https://github.com/terraform-aws-modules/terraform-aws-vpc/pull/926 before changing logic
value = length(aws_route_table.database[*].id) > 0 ? aws_route_table.database[*].id : aws_route_table.private[*].id
}

output "database_internet_gateway_route_id" {
Expand Down

0 comments on commit e4c48d4

Please sign in to comment.