UPD: Improved outputs with more details.

This commit is contained in:
xpk 2024-10-22 17:09:26 +08:00
parent c6614d4d48
commit 5a4570be72
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
2 changed files with 36 additions and 19 deletions

View File

@ -1,5 +1,4 @@
<!-- This readme file is generated with terraform-docs --> <!-- This readme file is generated with terraform-docs -->
# Overview
This module performs the following tasks: This module performs the following tasks:
- Create VPC, vpcflow log - Create VPC, vpcflow log
@ -78,17 +77,16 @@ This module performs the following tasks:
| Name | Description | | Name | Description |
|------|-------------| |------|-------------|
| azs | n/a | | private-subnet-details | Details of private subnets |
| private-subnet-azs | n/a | | private-subnet-ids | List of private subnet id |
| private-subnet-ids | n/a | | private\_subnets | Private subnet cidrs |
| private\_subnets | n/a | | public-route-table-id | Public route table id |
| public-route-table-id | n/a | | public-subnet-details | Details of public subnets |
| public-subnet-azs | n/a | | public-subnet-ids | List of public subnet id |
| public-subnet-ids | n/a | | public\_subnets | Public subnet cidrs |
| public\_subnets | n/a | | secondary\_cidr\_blocks | Secondary CIDR block |
| secondary\_cidr\_blocks | n/a | | vpc-cidr | VPC primary cidr |
| vpc-cidr | n/a | | vpc\_id | VPC id |
| vpc\_id | n/a |
--- ---
## Authorship ## Authorship

View File

@ -1,24 +1,30 @@
output "vpc_id" { output "vpc_id" {
description = "VPC id"
value = aws_vpc.vpc.id value = aws_vpc.vpc.id
} }
output "vpc-cidr" { output "vpc-cidr" {
description = "VPC primary cidr"
value = aws_vpc.vpc.cidr_block value = aws_vpc.vpc.cidr_block
} }
output "public_subnets" { output "public_subnets" {
description = "Public subnet cidrs"
value = aws_subnet.public-subnets.*.cidr_block value = aws_subnet.public-subnets.*.cidr_block
} }
output "private_subnets" { output "private_subnets" {
description = "Private subnet cidrs"
value = aws_subnet.private-subnets.*.cidr_block value = aws_subnet.private-subnets.*.cidr_block
} }
output "public-subnet-ids" { output "public-subnet-ids" {
description = "List of public subnet id"
value = aws_subnet.public-subnets.*.id value = aws_subnet.public-subnets.*.id
} }
output "private-subnet-ids" { output "private-subnet-ids" {
description = "List of private subnet id"
value = aws_subnet.private-subnets.*.id value = aws_subnet.private-subnets.*.id
} }
@ -27,6 +33,7 @@ output "private-subnet-ids" {
# } # }
output "public-route-table-id" { output "public-route-table-id" {
description = "Public route table id"
value = aws_route_table.public-route-table.*.id value = aws_route_table.public-route-table.*.id
} }
@ -35,17 +42,29 @@ output "public-route-table-id" {
# } # }
output "secondary_cidr_blocks" { output "secondary_cidr_blocks" {
description = "Secondary CIDR block"
value = var.secondary_cidr_blocks value = var.secondary_cidr_blocks
} }
output "public-subnet-azs" { output "public-subnet-details" {
value = distinct(aws_subnet.public-subnets.*.availability_zone) description = "Details of public subnets"
value = [
for k, v in aws_subnet.public-subnets : {
cidr = v.cidr_block,
az = v.availability_zone,
name = v.tags["Name"]
}
]
} }
output "private-subnet-azs" { output "private-subnet-details" {
value = distinct(aws_subnet.private-subnets.*.availability_zone) description = "Details of private subnets"
value = [
for k, v in aws_subnet.public-subnets : {
cidr = v.cidr_block,
az = v.availability_zone,
name = v.tags["Name"]
}
]
} }
output "azs" {
value = data.aws_availability_zones.available-az.names
}