diff --git a/README.md b/README.md index b7a76ba..ec4ebdc 100644 --- a/README.md +++ b/README.md @@ -99,15 +99,15 @@ resource "aws_lambda_function" "test_lambda" { | Kind | Source | Name | Provider | |------|--------|------|----------| | data source | [`data.aws_caller_identity`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | `current` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | -| data source | [`data.aws_internet_gateway`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/internet_gateway) | `default` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | -| data source | [`data.aws_network_acls`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/network_acls) | `default` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | +| data source | [`data.aws_internet_gateway`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/internet_gateway) | `igw` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | +| data source | [`data.aws_network_acls`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/network_acls) | `nacl` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | | data source | [`data.aws_region`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | `current` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | | data source | [`data.aws_route_table`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route_table) | `route_table` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | | data source | [`data.aws_subnet`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet) | `subnet_int_a` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | | data source | [`data.aws_subnet`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet) | `subnet_int_b` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | | data source | [`data.aws_subnet`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet) | `subnet_int_c` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | | data source | [`data.aws_subnets`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | `subnets` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | -| data source | [`data.aws_vpc`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | `default` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | +| data source | [`data.aws_vpc`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | `vpc` | [hashicorp/aws](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) | ## Testing diff --git a/data.tf b/data.tf index 3db39ad..fe47d23 100644 --- a/data.tf +++ b/data.tf @@ -1,51 +1,51 @@ # Expects a single VPC in the account, and will fail if there are none or more than one. # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc -data "aws_vpc" "default" {} +data "aws_vpc" "vpc" {} # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets data "aws_subnets" "subnets" { filter { name = "vpc-id" values = [ - data.aws_vpc.default.id, + data.aws_vpc.vpc.id, ] } } # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet data "aws_subnet" "subnet_int_a" { - vpc_id = data.aws_vpc.default.id + vpc_id = data.aws_vpc.vpc.id availability_zone = "${data.aws_region.current.name}a" } # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet data "aws_subnet" "subnet_int_b" { - vpc_id = data.aws_vpc.default.id + vpc_id = data.aws_vpc.vpc.id availability_zone = "${data.aws_region.current.name}b" } # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet data "aws_subnet" "subnet_int_c" { - vpc_id = data.aws_vpc.default.id + vpc_id = data.aws_vpc.vpc.id availability_zone = "${data.aws_region.current.name}c" } # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route_table data "aws_route_table" "route_table" { - vpc_id = data.aws_vpc.default.id + vpc_id = data.aws_vpc.vpc.id } # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/internet_gateway -data "aws_internet_gateway" "default" { +data "aws_internet_gateway" "igw" { filter { name = "attachment.vpc-id" values = [ - data.aws_vpc.default.id, + data.aws_vpc.vpc.id, ] } } # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/network_acls -data "aws_network_acls" "default" { - vpc_id = data.aws_vpc.default.id +data "aws_network_acls" "nacl" { + vpc_id = data.aws_vpc.vpc.id } diff --git a/outputs.tf b/outputs.tf index 4c4b31b..b404b49 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,21 +1,21 @@ output "vpc" { description = "An object containing all VPC data." - value = data.aws_vpc.default + value = data.aws_vpc.vpc } output "vpc_arn" { description = "The ARN of the VPC in this account." - value = data.aws_vpc.default.arn + value = data.aws_vpc.vpc.arn } output "vpc_cidr" { description = "The CIDR of the VPC in this account." - value = data.aws_vpc.default.cidr_block + value = data.aws_vpc.vpc.cidr_block } output "vpc_id" { description = "The ID of the VPC in this account." - value = data.aws_vpc.default.id + value = data.aws_vpc.vpc.id } #------------------------------------------------------------------------------- @@ -142,27 +142,27 @@ output "route_table_id" { output "internet_gateway" { description = "An object containing all data for this internet gateway." - value = data.aws_internet_gateway.default + value = data.aws_internet_gateway.igw } output "internet_gateway_arn" { description = "The ARN of this internet gateway." - value = data.aws_internet_gateway.default.arn + value = data.aws_internet_gateway.igw.arn } output "internet_gateway_id" { description = "The ID of this internet gateway." - value = data.aws_internet_gateway.default.id + value = data.aws_internet_gateway.igw.id } #------------------------------------------------------------------------------- output "nacl" { description = "An object containing all data for this Network Access Control List (NACL)." - value = data.aws_network_acls.default + value = data.aws_network_acls.nacl } output "nacl_ids" { description = "List of all Network Access Control List (NACL) IDs in the VPC." - value = data.aws_network_acls.default.ids + value = data.aws_network_acls.nacl.ids }