From d6a5b18cc1909117877095f1036d5f1b5cc5fea0 Mon Sep 17 00:00:00 2001 From: Veronika Gnilitska <30597968+gberenice@users.noreply.github.com> Date: Thu, 7 Jul 2022 18:22:08 +0300 Subject: [PATCH] Replace deprecated data source 'aws_subnet_ids' (#64) Co-authored-by: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com> --- README.md | 2 +- docs/terraform.md | 2 +- requester.tf | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6f9cd8b..c9e2581 100644 --- a/README.md +++ b/README.md @@ -360,8 +360,8 @@ Available targets: | [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_route_tables.default_rts](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route_tables) | 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_subnets.requester](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 | diff --git a/docs/terraform.md b/docs/terraform.md index 1f79580..28bbdb8 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -38,8 +38,8 @@ | [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_route_tables.default_rts](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route_tables) | 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_subnets.requester](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 | diff --git a/requester.tf b/requester.tf index 16801b9..fcd4cb3 100644 --- a/requester.tf +++ b/requester.tf @@ -104,15 +104,18 @@ data "aws_vpc" "requester" { } # Lookup requester subnets -data "aws_subnet_ids" "requester" { +data "aws_subnets" "requester" { count = local.count provider = aws.requester - vpc_id = local.requester_vpc_id - tags = var.requester_subnet_tags + filter { + name = "vpc-id" + values = [local.requester_vpc_id] + } + tags = var.requester_subnet_tags } locals { - requester_subnet_ids = try(distinct(sort(flatten(data.aws_subnet_ids.requester.*.ids))), []) + requester_subnet_ids = try(distinct(sort(flatten(data.aws_subnets.requester.*.ids))), []) requester_subnet_ids_count = length(local.requester_subnet_ids) requester_vpc_id = join("", data.aws_vpc.requester.*.id) }