# punitkashyup/iac-sample-project architecture

> Architecture diagram of the GitHub repository punitkashyup/iac-sample-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/punitkashyup/iac-sample-project
- Repository: https://github.com/punitkashyup/iac-sample-project

## Overview

##### Main Components

A. Provider & Backend Layer
- AWS Provider configuration
- Backend configuration (indicated by backend.tf and backend-setup directory)
- Use a cloud symbol with AWS logo

B. Module Structure (Core architectural component)
- Four main modules identified:
- VPC Module
- Networking Module
- EC2 Module
- S3 Module
- Module as a distinct container

C. Resource Layer
- Actual AWS resources being created
- Resources by module

**Level 1: Terraform Configuration**
**┌─────────────────────────────────┐**
- main.tf / variables.tf / outputs.tf │
- ┘

**Level 2: Modules Layer**
**┌────────┐ ┌──────────┐ ┌─────┐ ┌────┐**
- VPC   │ │Networking│ │ EC2 │ │ S3 │
- ┘ └──────────┘ └─────┘ └────┘

**Level 3: AWS Resources Layer**
**[Actual AWS resources created by each module]**

##### Specific Elements

A. VPC Module Section:
- VPC boundary
- CIDR block configuration
- Connection to Networking module

B. Networking Module Section:
- Public subnet representation
- Security group configurations
- Routing tables

C. EC2 Module Section:
- EC2 instance
- User data script indication
- GitHub integration for code deployment
- Connection to networking components

D. S3 Module Section:
- S3 bucket
- Versioning configuration
- Access points

##### Connection and Flow Indicators

- Resource creation flow (green)
- Network traffic flow (blue)
- Data access patterns (orange)

##### Additional Elements

- Environment indicator (dev/prod)
- AWS region boundary
- Security group rules visualization
- Tags and naming conventions

##### Technical Details to Highlight

- Backend configuration for state management
- Variable relationships between modules
- Output dependencies
- Resource naming patterns
- Security group rules and access patterns

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Terraform Configuration Layer"
        MainConfig["Main Configuration Files"]:::config
        Variables["Variables Configuration"]:::config
        Outputs["Outputs Configuration"]:::config
        Backend["Backend Configuration"]:::config
        RemoteBackend["Remote Backend Setup"]:::config
    end

    subgraph "Module Layer"
        VPCMod["VPC Module"]:::module
        NetworkMod["Networking Module"]:::module
        EC2Mod["EC2 Module"]:::module
        S3Mod["S3 Module"]:::module
    end

    subgraph "AWS Resources Layer"
        VPC["VPC Resources"]:::resource
        Subnets["Public Subnets"]:::resource
        SecGroups["Security Groups"]:::resource
        Routes["Route Tables"]:::resource
        EC2["EC2 Instances"]:::resource
        S3["S3 Bucket"]:::resource
    end

    MainConfig --> VPCMod
    MainConfig --> NetworkMod
    MainConfig --> EC2Mod
    MainConfig --> S3Mod
    
    VPCMod --> VPC
    NetworkMod --> Subnets
    NetworkMod --> SecGroups
    NetworkMod --> Routes
    EC2Mod --> EC2
    S3Mod --> S3

    %% Resource Dependencies
    VPC -.-> Subnets
    Subnets -.-> EC2
    SecGroups -.-> EC2
    Routes -.-> Subnets

    %% Click Events
    click MainConfig "https://github.com/punitkashyup/IAC-Sample-Project/blob/main/main.tf"
    click Variables "https://github.com/punitkashyup/IAC-Sample-Project/blob/main/variables.tf"
    click Outputs "https://github.com/punitkashyup/IAC-Sample-Project/blob/main/outputs.tf"
    click Backend "https://github.com/punitkashyup/IAC-Sample-Project/blob/main/backend.tf"
    click RemoteBackend "https://github.com/punitkashyup/IAC-Sample-Project/blob/main/backend-setup/remote-backend-setup.tf"
    
    click VPCMod "https://github.com/punitkashyup/IAC-Sample-Project/tree/main/modules/vpc"
    click NetworkMod "https://github.com/punitkashyup/IAC-Sample-Project/tree/main/modules/networking"
    click EC2Mod "https://github.com/punitkashyup/IAC-Sample-Project/tree/main/modules/ec2"
    click S3Mod "https://github.com/punitkashyup/IAC-Sample-Project/tree/main/modules/s3"

    classDef config fill:#f9f,stroke:#333,stroke-width:2px
    classDef module fill:#bbf,stroke:#333,stroke-width:2px
    classDef resource fill:#bfb,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        ConfigL["Configuration"]:::config
        ModuleL["Module"]:::module
        ResourceL["AWS Resource"]:::resource
    end
```
