From a6d489e2db1ef7bb319757eac5057d9aa0954f4f Mon Sep 17 00:00:00 2001 From: rxnjitth Date: Tue, 14 Oct 2025 15:13:54 +0530 Subject: [PATCH] DevOps: VPC Module: Update NAT Gateway EIP configuration and add additional outputs for VPC resources --- .../infrastructure/modules/vpc/main.tf | 2 +- .../infrastructure/modules/vpc/outputs.tf | 37 ++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/DevOps-Project-01/infrastructure/modules/vpc/main.tf b/DevOps-Project-01/infrastructure/modules/vpc/main.tf index bbff2cc..19524cc 100644 --- a/DevOps-Project-01/infrastructure/modules/vpc/main.tf +++ b/DevOps-Project-01/infrastructure/modules/vpc/main.tf @@ -52,7 +52,7 @@ resource "aws_subnet" "private" { # Elastic IP for NAT Gateway resource "aws_eip" "nat" { count = length(var.public_subnets) - vpc = true + domain = "vpc" tags = { Name = "${var.environment}-nat-eip-${count.index + 1}" diff --git a/DevOps-Project-01/infrastructure/modules/vpc/outputs.tf b/DevOps-Project-01/infrastructure/modules/vpc/outputs.tf index 9716b6e..0bc430f 100644 --- a/DevOps-Project-01/infrastructure/modules/vpc/outputs.tf +++ b/DevOps-Project-01/infrastructure/modules/vpc/outputs.tf @@ -21,4 +21,39 @@ output "nat_gateway_ids" { output "vpc_cidr_block" { description = "CIDR block of the VPC" value = aws_vpc.main.cidr_block -} \ No newline at end of file +} + +output "vpc_name" { + description = "Name tag of the VPC" + value = aws_vpc.main.tags.Name +} + +output "internet_gateway_id" { + description = "ID of the Internet Gateway" + value = aws_internet_gateway.main.id +} + +output "public_route_table_ids" { + description = "ID of the public route table" + value = aws_route_table.public.id +} + +output "private_route_table_ids" { + description = "List of IDs of private route tables" + value = aws_route_table.private[*].id +} + +output "public_subnet_cidrs" { + description = "List of CIDR blocks of public subnets" + value = aws_subnet.public[*].cidr_block +} + +output "private_subnet_cidrs" { + description = "List of CIDR blocks of private subnets" + value = aws_subnet.private[*].cidr_block +} + +output "nat_gateway_elastic_ips" { + description = "List of Elastic IP addresses associated with NAT Gateways" + value = aws_eip.nat[*].public_ip +} \ No newline at end of file