# appsmithorg/appsmith-tf-modules architecture

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

- Interactive diagram: https://gitdiagram.com/appsmithorg/appsmith-tf-modules
- Repository: https://github.com/appsmithorg/appsmith-tf-modules

## Overview

- Terraform Core: At the center, denote the Terraform engine that orchestrates the deployment.
- AWS Modules:
- AWS ECS EC2: Represented by the aws/ecs_ec2 directory, which contains the standard ECS deployment using EC2 instances.
- AWS ECS EC2 with EFS: Represented by aws/ecs_ec2_efs for configurations that integrate Elastic File System (EFS) with ECS EC2.
- AWS ECS Fargate: Represented by aws/ecs_fargate for deployments using AWS Fargate (serverless container hosting).
- GCP Modules:
- GCP Cloud Run: Represented by gcp/cloud_run for deploying Appsmith on Google Cloud Run.

##### Relationships and Interactions
- Similarly, show a separate branch from Terraform to the GCP Cloud Run module.

##### Architectural Patterns and Design Principles
- Module Reusability: Clearly state that each directory is a self-contained module with its own configuration parameters, allowing the modules to be reused or swapped based on cloud provider or performance/scalability needs.
- Separation of Concerns: Demonstrate that the design cleanly separates the deployment configurations for AWS and GCP, and further subdivides AWS deployments into different compute options (EC2 vs. Fargate) with optional features (EFS).
- Infrastructure as Code (IaC): Indicate that Terraform is being used to declaratively manage cloud resources for Appsmith, ensuring consistency and version control.

##### Relevant Technologies and Frameworks
- Terraform (specifically version 1.3.1 as mentioned in the README) is the core technology.
- AWS services (EC2, ECS, Fargate, EFS) for the AWS modules.
- Google Cloud Run for the GCP module.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Terraform Engine"]:::terraform

    subgraph "AWS Modules"
        EC2["AWS - ECS EC2<br/>(main.tf, variables.tf, outputs.tf)"]:::aws
        EC2_EFS["AWS - ECS EC2 with EFS<br/>(main.tf, variables.tf, outputs.tf)"]:::aws
        Fargate["AWS - ECS Fargate<br/>(main.tf, variables.tf, outputs.tf)"]:::aws
    end

    subgraph "GCP Modules"
        CloudRun["GCP - Cloud Run<br/>(main.tf)"]:::gcp
    end

    A -->|"deploys"| EC2
    A -->|"deploys"| EC2_EFS
    A -->|"deploys"| Fargate
    A -->|"deploys"| CloudRun

    EC2 ---|"optional_EFS"| EC2_EFS

    click EC2 "https://github.com/appsmithorg/appsmith-tf-modules/tree/main/aws/ecs_ec2"
    click EC2_EFS "https://github.com/appsmithorg/appsmith-tf-modules/tree/main/aws/ecs_ec2_efs"
    click Fargate "https://github.com/appsmithorg/appsmith-tf-modules/tree/main/aws/ecs_fargate"
    click CloudRun "https://github.com/appsmithorg/appsmith-tf-modules/tree/main/gcp/cloud_run"

    classDef terraform fill:#ADD8E6,stroke:#333,stroke-width:2px,color:#000;
    classDef aws fill:#FFD700,stroke:#333,stroke-width:2px,color:#000;
    classDef gcp fill:#90EE90,stroke:#333,stroke-width:2px,color:#000;
```
