Skip to content

Commit

Permalink
Added try to options to avoid errors when enabled is false (#19) (#20)
Browse files Browse the repository at this point in the history
Co-authored-by: actions-bot <[email protected]>
  • Loading branch information
JamesTimms and actions-bot authored Nov 23, 2020
1 parent 6260020 commit f8552f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions accepter.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ data "aws_subnet_ids" "accepter" {
}

locals {
accepter_subnet_ids = distinct(sort(flatten(data.aws_subnet_ids.accepter.*.ids)))
accepter_subnet_ids = try(distinct(sort(flatten(data.aws_subnet_ids.accepter.*.ids))), [])
accepter_subnet_ids_count = length(local.accepter_subnet_ids)
accepter_vpc_id = join("", data.aws_vpc.accepter.*.id)
accepter_account_id = join("", data.aws_caller_identity.accepter.*.account_id)
Expand All @@ -75,7 +75,7 @@ data "aws_route_tables" "accepter" {
}

locals {
accepter_aws_route_table_ids = try(distinct(sort(data.aws_route_tables.accepter[0].ids)), "")
accepter_aws_route_table_ids = try(distinct(sort(data.aws_route_tables.accepter[0].ids)), [])
accepter_aws_route_table_ids_count = length(local.accepter_aws_route_table_ids)
accepter_cidr_block_associations = flatten(data.aws_vpc.accepter.*.cidr_block_associations)
accepter_cidr_block_associations_count = length(local.accepter_cidr_block_associations)
Expand Down
4 changes: 2 additions & 2 deletions requester.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ data "aws_subnet_ids" "requester" {
}

locals {
requester_subnet_ids = distinct(sort(flatten(data.aws_subnet_ids.requester.*.ids)))
requester_subnet_ids = try(distinct(sort(flatten(data.aws_subnet_ids.requester.*.ids))), [])
requester_subnet_ids_count = length(local.requester_subnet_ids)
requester_vpc_id = join("", data.aws_vpc.requester.*.id)
}
Expand Down Expand Up @@ -139,7 +139,7 @@ resource "aws_vpc_peering_connection_options" "requester" {
}

locals {
requester_aws_route_table_ids = distinct(sort(data.aws_route_table.requester.*.route_table_id))
requester_aws_route_table_ids = try(distinct(sort(data.aws_route_table.requester.*.route_table_id)), [])
requester_aws_route_table_ids_count = length(local.requester_aws_route_table_ids)
requester_cidr_block_associations = flatten(data.aws_vpc.requester.*.cidr_block_associations)
requester_cidr_block_associations_count = length(local.requester_cidr_block_associations)
Expand Down

0 comments on commit f8552f4

Please sign in to comment.