157 lines
4.5 KiB
HCL
157 lines
4.5 KiB
HCL
# Foundation Layer Outputs
|
|
# These outputs will be used by subsequent layers (Shared Services and Application)
|
|
|
|
# VPC Information
|
|
output "vpc_id" {
|
|
description = "ID of the VPC"
|
|
value = aws_vpc.main.id
|
|
}
|
|
|
|
output "vpc_cidr_block" {
|
|
description = "CIDR block of the VPC"
|
|
value = aws_vpc.main.cidr_block
|
|
}
|
|
|
|
output "vpc_arn" {
|
|
description = "ARN of the VPC"
|
|
value = aws_vpc.main.arn
|
|
}
|
|
|
|
# Subnet Information
|
|
output "public_subnet_ids" {
|
|
description = "List of IDs of the public subnets"
|
|
value = aws_subnet.public[*].id
|
|
}
|
|
|
|
output "private_subnet_ids" {
|
|
description = "List of IDs of the private subnets"
|
|
value = var.enable_private_subnets ? aws_subnet.private[*].id : []
|
|
}
|
|
|
|
output "public_subnet_cidrs" {
|
|
description = "List of CIDR blocks of the public subnets"
|
|
value = aws_subnet.public[*].cidr_block
|
|
}
|
|
|
|
output "private_subnet_cidrs" {
|
|
description = "List of CIDR blocks of the private subnets"
|
|
value = var.enable_private_subnets ? aws_subnet.private[*].cidr_block : []
|
|
}
|
|
|
|
# For free tier: use public subnets as "app subnets" when private subnets are disabled
|
|
output "app_subnet_ids" {
|
|
description = "List of subnet IDs to use for application deployment (private if available, public if cost-optimized)"
|
|
value = var.enable_private_subnets ? aws_subnet.private[*].id : aws_subnet.public[*].id
|
|
}
|
|
|
|
# Availability Zones
|
|
output "availability_zones" {
|
|
description = "List of availability zones"
|
|
value = data.aws_availability_zones.available.names
|
|
}
|
|
|
|
# Gateway Information
|
|
output "internet_gateway_id" {
|
|
description = "ID of the Internet Gateway"
|
|
value = aws_internet_gateway.main.id
|
|
}
|
|
|
|
output "nat_gateway_ids" {
|
|
description = "List of IDs of the NAT Gateways"
|
|
value = var.enable_private_subnets && var.enable_nat_gateway ? aws_nat_gateway.main[*].id : []
|
|
}
|
|
|
|
output "nat_gateway_public_ips" {
|
|
description = "List of public Elastic IPs of NAT Gateways"
|
|
value = var.enable_private_subnets && var.enable_nat_gateway ? aws_eip.nat[*].public_ip : []
|
|
}
|
|
|
|
# Security Group Information
|
|
output "default_security_group_id" {
|
|
description = "ID of the default security group"
|
|
value = aws_security_group.default.id
|
|
}
|
|
|
|
output "alb_security_group_id" {
|
|
description = "ID of the ALB security group"
|
|
value = aws_security_group.alb.id
|
|
}
|
|
|
|
output "ecs_tasks_security_group_id" {
|
|
description = "ID of the ECS tasks security group"
|
|
value = aws_security_group.ecs_tasks.id
|
|
}
|
|
|
|
output "vpc_endpoints_security_group_id" {
|
|
description = "ID of the VPC endpoints security group"
|
|
value = null # Not created in free tier version to avoid costs
|
|
}
|
|
|
|
# Route Table Information
|
|
output "public_route_table_id" {
|
|
description = "ID of the public route table"
|
|
value = aws_route_table.public.id
|
|
}
|
|
|
|
output "private_route_table_ids" {
|
|
description = "List of IDs of the private route tables"
|
|
value = var.enable_private_subnets ? aws_route_table.private[*].id : []
|
|
}
|
|
|
|
# VPC Endpoint Information
|
|
output "s3_vpc_endpoint_id" {
|
|
description = "ID of the S3 VPC endpoint"
|
|
value = var.enable_vpc_endpoints ? aws_vpc_endpoint.s3[0].id : null
|
|
}
|
|
|
|
output "ecr_dkr_vpc_endpoint_id" {
|
|
description = "ID of the ECR Docker VPC endpoint"
|
|
value = null # Disabled in free tier version
|
|
}
|
|
|
|
output "ecr_api_vpc_endpoint_id" {
|
|
description = "ID of the ECR API VPC endpoint"
|
|
value = null # Disabled in free tier version
|
|
}
|
|
|
|
output "logs_vpc_endpoint_id" {
|
|
description = "ID of the CloudWatch Logs VPC endpoint"
|
|
value = null # Disabled in free tier version
|
|
}
|
|
|
|
# Terraform Backend Information
|
|
output "terraform_state_bucket_name" {
|
|
description = "Name of the S3 bucket for Terraform state"
|
|
value = aws_s3_bucket.terraform_state.bucket
|
|
}
|
|
|
|
output "terraform_state_bucket_arn" {
|
|
description = "ARN of the S3 bucket for Terraform state"
|
|
value = aws_s3_bucket.terraform_state.arn
|
|
}
|
|
|
|
output "terraform_locks_table_name" {
|
|
description = "Name of the DynamoDB table for Terraform locks"
|
|
value = aws_dynamodb_table.terraform_locks.name
|
|
}
|
|
|
|
output "terraform_locks_table_arn" {
|
|
description = "ARN of the DynamoDB table for Terraform locks"
|
|
value = aws_dynamodb_table.terraform_locks.arn
|
|
}
|
|
|
|
# Project Information
|
|
output "project_name" {
|
|
description = "Name of the project"
|
|
value = var.project_name
|
|
}
|
|
|
|
output "environment" {
|
|
description = "Environment name"
|
|
value = var.environment
|
|
}
|
|
|
|
output "aws_region" {
|
|
description = "AWS region"
|
|
value = var.aws_region
|
|
} |