# coralogix/terraform-coralogix-aws architecture

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

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

## Overview

##### Main Components
- Terraform Modules – The heart of the project. There are individual modules for each integration (for example, coralogix-aws-shipper, ecs-ec2, firehose-logs, firehose-metrics, resource-metadata, resource-metadata-sqs, eventbridge, s3-archive, and others). Each module comprises the Terraform code necessary to create and configure the corresponding AWS resources.
- Examples – These directories provide sample configurations illustrating how to use the modules. They typically mirror the structure of their associated modules and give an “end-to-end” view.
- Tests – The tests directory contains infrastructure validation scripts and Terraform configurations that ensure the modules work as expected.
- CI/CD & Repository Config – Files such as GitHub workflows, changelog scripts, and documentation sync setups indicate that there is a continuous integration and release process ensuring the quality of the modules.

##### Relationships and Interactions
- How these modules deploy AWS resources – for example, AWS Lambda (for coralogix-aws-shipper), ECS (for ecs-ec2), Firehose (for firehose-logs and firehose-metrics), S3 (for s3-archive), and other AWS services.
- External integration points such as the Coralogix platform, which receives the data from these deployed modules.

##### Architectural Patterns and Design Principles
- Modularization: The design is centered around reusable Terraform modules — each handling a specific AWS integration.
- Extensibility: The project is designed to allow users to easily add or update AWS integrations by plugging in different modules.
- CI/CD Integration: Represent the automated workflows (from the .github/workflows directory) that ensure quality and proper release management.

##### Relevant Technologies and Frameworks
- Terraform itself is the core technology for defining infrastructure. Mark it as the orchestration tool.
- AWS services (Lambda, ECS, CloudWatch, EventBridge, Firehose, S3, etc.) are deployed and managed via Terraform.
- GitHub Actions (as seen in the workflows) for automation.
- Code quality and testing tools indicated by tests scripts.
- Coralogix as the external monitoring or logging platform receiving the data events and metrics.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Infrastructure
    subgraph "Core Infrastructure"
        TO("Terraform Orchestration"):::orchestration
        subgraph "Terraform Modules"
            mod_coralogix("coralogix-aws-shipper Module"):::modules
            mod_ecs("ecs-ec2 Module"):::modules
            mod_eventbridge("eventbridge Module"):::modules
            mod_firehose_logs("firehose-logs Module"):::modules
            mod_firehose_metrics("firehose-metrics Module"):::modules
            mod_lambda_manager("lambda-manager Module"):::modules
            mod_lambda_secretLayer("lambda-secretLayer Module"):::modules
            mod_msk_data_stream("msk-data-stream Module"):::modules
            mod_s3_archive("s3-archive Module"):::modules
            mod_resource_metadata("resource-metadata Module"):::modules
            mod_resource_metadata_sqs("resource-metadata-sqs Module"):::modules
            mod_cloudwatch_metrics_iam_role("cloudwatch-metrics-iam-role Module"):::modules
            mod_locals_vars("locals_variables Module"):::modules
        end
        subgraph "AWS Services"
            aws_lambda("AWS Lambda"):::aws
            aws_ecs("AWS ECS"):::aws
            aws_firehose("AWS Firehose"):::aws
            aws_eventbridge("AWS EventBridge"):::aws
            aws_s3("AWS S3"):::aws
            aws_cloudwatch("AWS CloudWatch"):::aws
            aws_msk("AWS MSK"):::aws
        end
        external_coralogix("Coralogix"):::external

        %% Connections from Orchestration to Modules
        TO --> mod_coralogix
        TO --> mod_ecs
        TO --> mod_eventbridge
        TO --> mod_firehose_logs
        TO --> mod_firehose_metrics
        TO --> mod_lambda_manager
        TO --> mod_lambda_secretLayer
        TO --> mod_msk_data_stream
        TO --> mod_s3_archive
        TO --> mod_resource_metadata
        TO --> mod_resource_metadata_sqs
        TO --> mod_cloudwatch_metrics_iam_role
        TO --> mod_locals_vars

        %% Module to AWS Service interactions
        mod_coralogix -->|"DeploysLambda"| aws_lambda
        mod_ecs -->|"DeploysECS"| aws_ecs
        mod_eventbridge -->|"SchedulesEvents"| aws_eventbridge
        mod_firehose_logs -->|"ProcessesLogs"| aws_firehose
        mod_firehose_metrics -->|"ProcessesMetrics"| aws_firehose
        mod_lambda_manager -->|"ManagesLambdas"| aws_lambda
        mod_lambda_secretLayer -->|"AddsSecretLayer"| aws_lambda
        mod_msk_data_stream -->|"StreamsData"| aws_msk
        mod_s3_archive -->|"ArchivesData"| aws_s3
        mod_resource_metadata -->|"SendsMetadata"| aws_cloudwatch
        mod_resource_metadata_sqs -->|"SendsMetadata"| aws_cloudwatch
        mod_cloudwatch_metrics_iam_role -->|"ConfiguresMetrics"| aws_cloudwatch

        %% AWS Services to External Output
        aws_lambda -->|"ForLogs"| external_coralogix
        aws_firehose -->|"ForLogsMetrics"| external_coralogix
        aws_ecs -->|"ForLogs"| external_coralogix
        aws_s3 -->|"ArchivesTo"| external_coralogix
        aws_cloudwatch -->|"MetricsTo"| external_coralogix
        aws_msk -->|"StreamsTo"| external_coralogix

        %% Optional connection between EventBridge and Lambda
        aws_eventbridge ---|"Triggers"| aws_lambda
    end

    %% Supporting Configuration
    subgraph "Supporting Config"
        subgraph "Examples"
            exp_coralogix("Coralogix AWS Shipper Example"):::support
            exp_ecs("ECS EC2 Example"):::support
            exp_eventbridge("EventBridge Example"):::support
            exp_firehose_logs("Firehose Logs Example"):::support
            exp_firehose_metrics("Firehose Metrics Example"):::support
            exp_lambda_manager("Lambda Manager Example"):::support
            exp_lambda_secretLayer("Lambda SecretLayer Example"):::support
            exp_msk_data_stream("MSK Data Stream Example"):::support
            exp_resource_metadata("Resource Metadata Example"):::support
            exp_resource_metadata_sqs("Resource Metadata SQS Example"):::support
            exp_s3_archive("S3 Archive Example"):::support
            exp_cloudwatch("CloudWatch Metrics IAM Role Example"):::support
        end
        subgraph "Tests"
            tests("Tests"):::support
        end
        subgraph "CI/CD & Repo Config"
            cicd_workflows("GitHub Workflows"):::support
            cicd_metadata("Repository Metadata"):::support
        end

        %% Examples reference corresponding Modules
        exp_coralogix --> mod_coralogix
        exp_ecs --> mod_ecs
        exp_eventbridge --> mod_eventbridge
        exp_firehose_logs --> mod_firehose_logs
        exp_firehose_metrics --> mod_firehose_metrics
        exp_lambda_manager --> mod_lambda_manager
        exp_lambda_secretLayer --> mod_lambda_secretLayer
        exp_msk_data_stream --> mod_msk_data_stream
        exp_resource_metadata --> mod_resource_metadata
        exp_resource_metadata_sqs --> mod_resource_metadata_sqs
        exp_s3_archive --> mod_s3_archive
        exp_cloudwatch --> mod_cloudwatch_metrics_iam_role

        %% Tests validate modules
        tests --> mod_coralogix
        tests --> mod_ecs
        tests --> mod_eventbridge
        tests --> mod_firehose_logs
        tests --> mod_firehose_metrics
        tests --> mod_lambda_manager
        tests --> mod_lambda_secretLayer
        tests --> mod_msk_data_stream
        tests --> mod_s3_archive
        tests --> mod_resource_metadata
        tests --> mod_resource_metadata_sqs
        tests --> mod_cloudwatch_metrics_iam_role
        tests --> mod_locals_vars

        %% CI/CD triggers orchestration
        cicd_workflows --> TO
        cicd_metadata --> TO
    end

    %% Class Definitions
    classDef orchestration fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;
    classDef modules fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef aws fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#943126,stroke-width:2px;
    classDef support fill:#FFCCBC,stroke:#E64A19,stroke-width:2px;

click mod_coralogix "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/coralogix-aws-shipper"
click mod_ecs "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/ecs-ec2"
click mod_eventbridge "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/eventbridge"
click mod_firehose_logs "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/firehose-logs"
click mod_firehose_metrics "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/firehose-metrics"
click mod_lambda_manager "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/lambda-manager"
click mod_lambda_secretLayer "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/lambda-secretLayer"
click mod_msk_data_stream "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/provisioning/msk-data-stream"
click mod_s3_archive "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/provisioning/s3-archive"
click mod_resource_metadata "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/resource-metadata"
click mod_resource_metadata_sqs "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/resource-metadata-sqs"
click mod_cloudwatch_metrics_iam_role "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/cloudwatch-metrics-iam-role"
click mod_locals_vars "https://github.com/coralogix/terraform-coralogix-aws/tree/master/modules/locals_variables"

click exp_coralogix "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/coralogix-aws-shipper"
click exp_ecs "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/ecs-ec2"
click exp_eventbridge "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/eventbridge"
click exp_firehose_logs "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/firehose-logs"
click exp_firehose_metrics "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/firehose-metrics"
click exp_lambda_manager "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/lambda-manager"
click exp_lambda_secretLayer "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/lambda-secretLayer"
click exp_msk_data_stream "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/msk-data-stream"
click exp_resource_metadata "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/resource-metadata"
click exp_resource_metadata_sqs "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/resource-metadata-sqs"
click exp_s3_archive "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/s3-archive"
click exp_cloudwatch "https://github.com/coralogix/terraform-coralogix-aws/tree/master/examples/cloudwatch-metrics-iam-role"

click tests "https://github.com/coralogix/terraform-coralogix-aws/tree/master/tests"
click cicd_workflows "https://github.com/coralogix/terraform-coralogix-aws/tree/master/.github/workflows"
click cicd_metadata "https://github.com/coralogix/terraform-coralogix-aws/blob/master/README.md"
```
