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 Default Route Table #62

Merged
merged 18 commits into from
Jun 28, 2022
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ Available targets:
| [aws_region.requester](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
| [aws_route_table.requester](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route_table) | data source |
| [aws_route_tables.accepter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route_tables) | data source |
| [aws_subnet_ids.accepter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source |
| [aws_subnet_ids.requester](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source |
| [aws_subnets.accepter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source |
| [aws_vpc.accepter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
| [aws_vpc.requester](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |

Expand Down
10 changes: 6 additions & 4 deletions accepter.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@ data "aws_vpc" "accepter" {
}

# Lookup accepter subnets
data "aws_subnet_ids" "accepter" {
data "aws_subnets" "accepter" {
count = local.accepter_count
provider = aws.accepter
vpc_id = local.accepter_vpc_id
tags = var.accepter_subnet_tags
filter {
name = "vpc-id"
values = [local.accepter_vpc_id]
}
Benbentwo marked this conversation as resolved.
Show resolved Hide resolved
}

locals {
accepter_subnet_ids = try(distinct(sort(flatten(data.aws_subnet_ids.accepter.*.ids))), [])
accepter_subnet_ids = try(local.accepter_enabled ? data.aws_subnets.accepter[0].ids : [], [])
Benbentwo marked this conversation as resolved.
Show resolved Hide resolved
aknysh marked this conversation as resolved.
Show resolved Hide resolved
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 Down
2 changes: 1 addition & 1 deletion docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
| [aws_region.requester](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
| [aws_route_table.requester](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route_table) | data source |
| [aws_route_tables.accepter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route_tables) | data source |
| [aws_subnet_ids.accepter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source |
| [aws_subnet_ids.requester](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source |
| [aws_subnets.accepter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source |
| [aws_vpc.accepter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
| [aws_vpc.requester](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |

Expand Down