# aafc-cloud/cloud-terrastodon architecture

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

- Interactive diagram: https://gitdiagram.com/aafc-cloud/cloud-terrastodon
- Repository: https://github.com/aafc-cloud/cloud-terrastodon

## Overview

##### Main Components Identification
The project consists of three main components:
- PowerShell Scripts (pwsh directory)
- Rust Core Implementation (rust directory)
- Visualization Component (visualizer directory)

- PowerShell Layer    |     |      Rust Core         |     |     Visualizer      |
- (Infrastructure    |     |     (Processing &       |     |    (Interactive     |
- Scanning)        |     |      Generation)        |     |     Rendering)      |

**PowerShell Layer → Rust Core:**
- Azure State Data

**Rust Core → PowerShell Layer:**
- Generated Terraform Code

**Rust Core ↔ Visualizer:**
- Resource Graph Data
- User Interactions

- Azure CLI     |

- ↑

- Cloud Terrastodon

- ↓

- Terraform    |

##### Important Notes
- Modular nature of the codebase
- Clear separation between scanning, processing, and visualization
- Bidirectional flow between components

##### Technical Details
- Azure API integration points
- Terraform code generation pipeline
- Resource visualization pipeline
- Command processing flow
- User interaction paths

## Diagram (Mermaid)

```mermaid
graph TB
    %% Main Layers
    subgraph PowerShell["PowerShell Layer"]
        RBAC["RBAC Scanning"]
        DNS["DNS Analysis"]
        Policy["Policy Compliance"]
        PIM["PIM Management"]
        Groups["Group Management"]
    end

    subgraph RustCore["Rust Core"]
        AzureAPI["Azure API Integration"]
        TerraGen["Terraform Generation"]
        Config["Configuration Management"]
        CmdProc["Command Processing"]
        UI["User Interface"]
        
        subgraph Types["Core Types"]
            AzTypes["Azure Types"]
            TFTypes["Terraform Types"]
            Entry["Main Entry Point"]
        end
    end

    subgraph Viz["Visualization Layer"]
        GraphViz["Graph Visualization"]
        Camera["Camera Controls"]
        Physics["Physics Simulation"]
        Layout["Layout Management"]
        AzureRender["Azure Resource Rendering"]
    end

    %% External Systems
    Azure[("Azure CLI")]
    Terraform[("Terraform")]

    %% Relationships
    Azure --> PowerShell
    PowerShell --> RustCore
    RustCore --> Terraform
    RustCore <--> Viz

    %% Component Relationships
    AzureAPI --> Types
    TerraGen --> Types
    CmdProc --> UI

    %% Click Events
    click RBAC "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/pwsh/rbac/"
    click DNS "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/pwsh/dangling-dns/"
    click Policy "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/pwsh/policy-compliance/"
    click PIM "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/pwsh/pim_widget/"
    click Groups "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/pwsh/groups/"
    
    click AzureAPI "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/rust/crates/azure/"
    click TerraGen "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/rust/crates/tofu/"
    click Config "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/rust/crates/config/"
    click CmdProc "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/rust/crates/command/"
    click UI "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/rust/crates/ui/"
    
    click GraphViz "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/visualizer/plugins/graph_nodes/"
    click Camera "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/visualizer/plugins/camera/"
    click Physics "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/visualizer/plugins/physics/"
    click Layout "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/visualizer/plugins/layout/"
    click AzureRender "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/visualizer/plugins/azure/"
    
    click AzTypes "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/rust/crates/azure_types/"
    click TFTypes "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/rust/crates/tofu_types/"
    click Entry "https://github.com/AAFC-Cloud/Cloud-Terrastodon/tree/main/rust/crates/entrypoint/"

    %% Styling
    classDef azure fill:#1E90FF
    classDef terraform fill:#32CD32
    classDef viz fill:#FFA500
    classDef external fill:#808080
    
    class AzureAPI,AzTypes azure
    class TerraGen,TFTypes terraform
    class GraphViz,Camera,Physics,Layout,AzureRender viz
    class Azure,Terraform external

    %% Legend
    subgraph Legend
        L1["Azure Components"]:::azure
        L2["Terraform Components"]:::terraform
        L3["Visualization Components"]:::viz
        L4["External Systems"]:::external
    end
```
