# jakeasaurus/terraform architecture

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

- Interactive diagram: https://gitdiagram.com/jakeasaurus/terraform
- Repository: https://github.com/jakeasaurus/terraform

## Overview

##### Project type and purpose
- This is a library of reusable Terraform modules targeting AWS resources.
- Each folder at the top level (ec2_server_2019_use1, s3_bucket, s3_website_cloudfront, s3_website_no_cloudfront, session_manager) is a standalone module that provisions a specific AWS service or pattern.
- The repository itself is an open-source Terraform module registry (MIT-licensed) that other teams reference via `source = "github.com/jakeasarus/terraform/INSERT-MODULE-HERE"`.

##### File structure
- Top-level directories = individual modules.
- Each module has:
– main.tf (defines resources)
– variables.tf (module inputs)
– outputs.tf (module outputs)
– examples/ (sample root-level Terraform that instantiates the module)
– some also include policy.json or other ancillary files (e.g., CloudFront policy).
- Supporting files:
- .gitignore, LICENSE, root README.md – global docs and license.
- github-workflows/terraform-fmt-commit.yml – CI step to auto-format Terraform code.

##### README
- Confirms the repo is purely a catalog of modules for others to reference.
- No single “application” or runtime; instead it delivers Terraform code that will be plugged into a larger infrastructure repo.

##### Detail
- Example configurations under each module to show testing/validation.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Consumers
    Consumer["Consumer Terraform Projects"]:::external
    Consumer -->|"source = ..."| Registry

    %% Module Registry
    subgraph "Module Registry (GitHub Repo)" 
        direction TB
        gitignore[".gitignore"]:::terraform
        license["LICENSE"]:::terraform
        repo_readme["README.md"]:::terraform

        ci["CI Workflow"]:::terraform
        gitignore --> ci
        license --> ci
        repo_readme --> ci

        subgraph "Modules" 
            direction TB

            subgraph "EC2 Server Module" 
                direction TB
                EC2_main["main.tf"]:::terraform
                EC2_vars["variables.tf"]:::terraform
                EC2_readme["README.md"]:::terraform
                EC2_example["examples/main.tf"]:::example
                EC2_main -->|"defines EC2"| EC2_Service
                EC2_vars --> EC2_Service
                EC2_example --> EC2_Service
            end

            subgraph "S3 Bucket Module" 
                direction TB
                S3B_main["main.tf"]:::terraform
                S3B_vars["variables.tf"]:::terraform
                S3B_out["outputs.tf"]:::terraform
                S3B_readme["README.md"]:::terraform
                S3B_example["examples/main.tf"]:::example
                S3B_main -->|"defines S3"| S3_Service
                S3B_vars --> S3_Service
                S3B_out --> S3_Service
                S3B_example --> S3_Service
            end

            subgraph "S3 Website w/ CloudFront Module" 
                direction TB
                S3WC_main["main.tf"]:::terraform
                S3WC_vars["variables.tf"]:::terraform
                S3WC_out["outputs.tf"]:::terraform
                S3WC_policy["policy.json"]:::terraform
                S3WC_readme["README.md"]:::terraform
                S3WC_ex_main["examples/main.tf"]:::example
                S3WC_ex_out["examples/outputs.tf"]:::example
                S3WC_main -->|"defines S3+CF"| S3_Service
                S3WC_vars --> S3_Service
                S3WC_out --> S3_Service
                S3WC_policy --> S3_Service
                S3WC_ex_main --> S3_Service
                S3WC_ex_out --> S3_Service
            end

            subgraph "S3 Website no CloudFront Module" 
                direction TB
                S3NC_main["main.tf"]:::terraform
                S3NC_vars["variables.tf"]:::terraform
                S3NC_out["outputs.tf"]:::terraform
                S3NC_readme["README.md"]:::terraform
                S3NC_ex_main["examples/main.tf"]:::example
                S3NC_ex_out["examples/outputs.tf"]:::example
                S3NC_main -->|"defines S3"| S3_Service
                S3NC_vars --> S3_Service
                S3NC_out --> S3_Service
                S3NC_ex_main --> S3_Service
                S3NC_ex_out --> S3_Service
            end

            subgraph "Session Manager Module" 
                direction TB
                SM_main["main.tf"]:::terraform
                SM_vars["variables.tf"]:::terraform
                SM_out["outputs.tf"]:::terraform
                SM_readme["README.md"]:::terraform
                SM_ex_main["examples/main.tf"]:::example
                SM_main -->|"defines SSM"| SM_Service
                SM_vars --> SM_Service
                SM_out --> SM_Service
                SM_ex_main --> SM_Service
            end

        end
    end

    %% AWS Services
    EC2_Service["EC2 Instance"]:::aws
    S3_Service["S3 Bucket"]:::aws
    SM_Service["SSM Session Manager"]:::aws

    %% Consumer applies modules
    Consumer -->|"terraform init & apply"| EC2_Service
    Consumer -->|"terraform init & apply"| S3_Service
    Consumer -->|"terraform init & apply"| SM_Service

    %% Module CI formatting
    ci -->|"terraform fmt"| EC2_main
    ci -->|"terraform fmt"| S3B_main
    ci -->|"terraform fmt"| S3WC_main
    ci -->|"terraform fmt"| S3NC_main
    ci -->|"terraform fmt"| SM_main

    %% Click Events
    click gitignore "https://github.com/jakeasaurus/terraform/blob/master/.gitignore"
    click license "https://github.com/jakeasaurus/terraform/tree/master/LICENSE"
    click repo_readme "https://github.com/jakeasaurus/terraform/blob/master/README.md"
    click ci "https://github.com/jakeasaurus/terraform/blob/master/github-workflows/terraform-fmt-commit.yml"

    click EC2_main "https://github.com/jakeasaurus/terraform/blob/master/ec2_server_2019_use1/main.tf"
    click EC2_vars "https://github.com/jakeasaurus/terraform/blob/master/ec2_server_2019_use1/variables.tf"
    click EC2_readme "https://github.com/jakeasaurus/terraform/blob/master/ec2_server_2019_use1/README.md"
    click EC2_example "https://github.com/jakeasaurus/terraform/blob/master/ec2_server_2019_use1/examples/main.tf"

    click S3B_main "https://github.com/jakeasaurus/terraform/blob/master/s3_bucket/main.tf"
    click S3B_vars "https://github.com/jakeasaurus/terraform/blob/master/s3_bucket/variables.tf"
    click S3B_out "https://github.com/jakeasaurus/terraform/blob/master/s3_bucket/outputs.tf"
    click S3B_readme "https://github.com/jakeasaurus/terraform/blob/master/s3_bucket/README.md"
    click S3B_example "https://github.com/jakeasaurus/terraform/blob/master/s3_bucket/examples/main.tf"

    click S3WC_main "https://github.com/jakeasaurus/terraform/blob/master/s3_website_cloudfront/main.tf"
    click S3WC_vars "https://github.com/jakeasaurus/terraform/blob/master/s3_website_cloudfront/variables.tf"
    click S3WC_out "https://github.com/jakeasaurus/terraform/blob/master/s3_website_cloudfront/outputs.tf"
    click S3WC_policy "https://github.com/jakeasaurus/terraform/blob/master/s3_website_cloudfront/policy.json"
    click S3WC_readme "https://github.com/jakeasaurus/terraform/blob/master/s3_website_cloudfront/README.md"
    click S3WC_ex_main "https://github.com/jakeasaurus/terraform/blob/master/s3_website_cloudfront/examples/main.tf"
    click S3WC_ex_out "https://github.com/jakeasaurus/terraform/blob/master/s3_website_cloudfront/examples/outputs.tf"

    click S3NC_main "https://github.com/jakeasaurus/terraform/blob/master/s3_website_no_cloudfront/main.tf"
    click S3NC_vars "https://github.com/jakeasaurus/terraform/blob/master/s3_website_no_cloudfront/variables.tf"
    click S3NC_out "https://github.com/jakeasaurus/terraform/blob/master/s3_website_no_cloudfront/outputs.tf"
    click S3NC_readme "https://github.com/jakeasaurus/terraform/blob/master/s3_website_no_cloudfront/README.md"
    click S3NC_ex_main "https://github.com/jakeasaurus/terraform/blob/master/s3_website_no_cloudfront/examples/main.tf"
    click S3NC_ex_out "https://github.com/jakeasaurus/terraform/blob/master/s3_website_no_cloudfront/examples/outputs.tf"

    click SM_main "https://github.com/jakeasaurus/terraform/blob/master/session_manager/main.tf"
    click SM_vars "https://github.com/jakeasaurus/terraform/blob/master/session_manager/variables.tf"
    click SM_out "https://github.com/jakeasaurus/terraform/blob/master/session_manager/outputs.tf"
    click SM_readme "https://github.com/jakeasaurus/terraform/blob/master/session_manager/README.md"
    click SM_ex_main "https://github.com/jakeasaurus/terraform/blob/master/session_manager/examples/main.tf"

    %% Styles
    classDef terraform fill:#D0E6F8,stroke:#0366D6,color:#0366D6
    classDef aws fill:#FFE1A8,stroke:#FF8C00,color:#FF8C00
    classDef example fill:#DFF8D8,stroke:#28A745,color:#28A745
    classDef external fill:#E2E2E2,stroke:#6A737D,color:#6A737D
```
