Skip to content

Commit

Permalink
Make the "enabled" flag work for resource aws_vpc_peering_connection_…
Browse files Browse the repository at this point in the history
…options (#23)

* put try around an expression which fails when enabled==false

* put count into the peering objects themselves

* Update requester.tf

Co-authored-by: Daniel Boesswetter <[email protected]>
Co-authored-by: nitro <[email protected]>
  • Loading branch information
3 people committed Aug 24, 2020
1 parent 48628c5 commit 071e574
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions accepter.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ data "aws_route_tables" "accepter" {
}

locals {
accepter_aws_route_table_ids = 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 Expand Up @@ -103,6 +103,7 @@ resource "aws_vpc_peering_connection_accepter" "accepter" {
}

resource "aws_vpc_peering_connection_options" "accepter" {
count = local.count
provider = aws.accepter
vpc_peering_connection_id = local.active_vpc_peering_connection_id

Expand All @@ -122,4 +123,4 @@ output "accepter_accept_status" {
aws_vpc_peering_connection_accepter.accepter.*.accept_status,
)
description = "Accepter VPC peering connection request status"
}
}
1 change: 1 addition & 0 deletions requester.tf
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ locals {
}

resource "aws_vpc_peering_connection_options" "requester" {
count = local.count
provider = aws.requester

# As options can't be set until the connection has been accepted
Expand Down

0 comments on commit 071e574

Please sign in to comment.