Skip to content

Commit

Permalink
Tweaked the naming of some of the resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Mar 26, 2024
1 parent a10a087 commit fb24d4b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
<!-- END_TF_DOCS -->

## Testing
Expand Down
20 changes: 10 additions & 10 deletions data.tf
Original file line number Diff line number Diff line change
@@ -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
}
18 changes: 9 additions & 9 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -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
}

0 comments on commit fb24d4b

Please sign in to comment.