How terraform-aws-modules/terraform-aws-vpc works
Component Identification
• VPC Core: Represent the overall VPC which wraps all networking resources.
• Subnets: Break the VPC into multiple subnet types – public, private, intra, database, redshift, elasticache, etc. Each subnet may have associated CIDR block details and attributes (IPv4, IPv6).
• Routing: Include Route Tables for each subnet type (default/public, private, intra, etc.) as well as associations linking subnets with corresponding route tables.
• Network ACLs & Security Groups: Identify dedicated or shared Network ACLs for different subnet groups.
• VPC Flow Logging: Add components for CloudWatch log groups, IAM roles/policies related to logging.
• External and Optional Resources: Show integration points with external Elastic IPs (especially when reusing NAT IPs) and examples of IPAM use for CIDR allocation.
Relationships and Interactions
• Public subnets connect to the Internet Gateway.
• Private subnets route traffic either through NAT Gateways or via a single shared NAT Gateway.
• Specialized subnets (intra, database, redshift, elasticache) are connected to their specific route tables and have separate network ACLs.
• Conditional relationships: for instance, when VPC Flow Logs are enabled, show the connection from VPC resources to the CloudWatch log group via the IAM role.
• If VPN gateway is enabled, indicate its attachment to the VPC and the associated route propagation to private and intra route tables.
Pattern and Design Principles
• Modular design: Emphasize the module’s reusability with “input” configuration across multiple examples.
• Separation of concerns: Distinguish components based on public vs. private network segregation (e.g., subnets, route tables, NAT versus IGW); network ACLs isolate different subnet types.
Technologies and Frameworks
• Terraform as the IaC tool.
• AWS Cloud resources: VPC, Subnet, Internet Gateway, NAT Gateway, VPN Gateway, CloudWatch, and AWS IAM.
• Support for both IPv4 and IPv6 addressing.
• Grouping related resources (all network ACLs in a cluster, all route table associations together) for clarity.
This thorough approach will give stakeholders, including principal software engineers, a clear high-level and detailed view of how the VPC is constructed, managed, and integrated within the AWS environment using this Terraform module.