# f5devcentral/f5-xc-tf-modules architecture

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

- Interactive diagram: https://gitdiagram.com/f5devcentral/f5-xc-tf-modules
- Repository: https://github.com/f5devcentral/f5-xc-tf-modules

## Overview

##### Main project purpose and type
- The project is an IaC repository that provides reusable Terraform templates for setting up network infrastructures and compute nodes across multiple environments (AWS, Azure, GCP, vsphere, etc.).
- Its purpose is to deploy and manage the “XC topologies” for F5 Networks deployments in various cloud and on-prem infrastructures.

##### File structure to determine key components
- Top-level directories by provider and environment:
- AWS: Contains modules for EC2 instances, instance state, network interfaces, security groups, subnets, VPC, and components under f5xc/ce/aws including clusters, nodes, and multiple networking configurations (common, nlb, node, secure, private).
- Azure: Similar structure with modules for resource groups, virtual networks, security groups, virtual machines, and dedicated networking templates.
- GCP: Contains modules for clusters, networking (common and private), firewalls, nodes, etc.
- f5xc: Under this directory you see structure for different providers (aws, azure, gcp, vsphere) as well as additional directories such as secure_mesh_site and status – these likely support F5-specific configurations, cluster orchestration, or monitoring aspects.
- utils: Modules that provide helper functionality (e.g., kubeconfig generation, update scripts, timeout handling).
- The existence of multiple similarly structured folders for supported providers hints at a modular, multi-cloud design with parallel components for networking, compute, and identity that are abstracted by Terraform.

##### Core components
- Cloud-Specific Modules: Within each provider, detail the main areas:
- Networking Components: VPC (or Virtual Network, Virtual Network in Azure), Subnets, Security Groups, and Network Interfaces.
- Compute/Nodes: EC2 instances, Linux Virtual Machines, or container clusters along with configurations for master and worker nodes.
- Load Balancing / Network Gateways: Components for network load balancers, secure/private networks.
- Utility Modules: Illustrate supporting components like kubeconfig generation and update/timeout modules that assist in provisioning or configuration validation.
- External Integrations: Indicate possible interactions with external systems such as community support, version control (GitHub) repositories, and CI/CD tooling for applying these Terraform templates.

##### Architectural relationships and interactions
- The f5xc module may interact with compute and network modules and could have a bidirectional relationship as it both configures and monitors the infrastructure.
- Inter-module dependencies: Networking must be provisioned prior to cluster/nodes creation; configuration templates (cloud_init files, hosts, etc.) are applied to nodes once they are provisioned.

##### Incorporate architectural patterns and technology choices
- Modular structure typical of Terraform, where each sub-directory (e.g., “main.tf”, “variables.tf”, “outputs.tf”, etc.) acts as a module that interfaces with others via inputs and outputs.
- Multi-cloud design pattern: the same “logical” topology (e.g., a secure mesh, a cluster configuration, load balancers) is deployed across different cloud providers using parallel module hierarchies.
- Terraform best practices such as using “locals” for reusable values and “templates” for bootstrapping compute nodes.

##### Putting it all together
- A separate section for “utils” that supports configuration and operational tasks across the deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% AWS Provider Subgraph
    subgraph "AWS Provider"
        aws_vpc("AWS VPC"):::awsStyle
        aws_subnets("AWS Subnets"):::awsStyle
        aws_sec("AWS Security Groups"):::awsStyle
        aws_netif("AWS Network Interfaces"):::awsStyle
        aws_ec2("AWS EC2 Nodes"):::awsStyle
        aws_instance_state("AWS Instance State"):::awsStyle
        aws_f5xc("AWS F5 XC Orchestration"):::f5xcStyle
    end

    %% Azure Provider Subgraph
    subgraph "Azure Provider"
        az_rg("Azure Resource Group"):::azureStyle
        az_vnet("Azure Virtual Network"):::azureStyle
        az_subnet("Azure Subnets"):::azureStyle
        az_sec("Azure Security Groups"):::azureStyle
        az_linux("Azure Linux VM"):::azureStyle
        az_f5xc("Azure F5 XC Orchestration"):::f5xcStyle
    end

    %% GCP Provider Subgraph
    subgraph "GCP Provider"
        gcp_net("GCP Networking"):::gcpStyle
        gcp_compute("GCP Compute Cluster"):::gcpStyle
        gcp_f5xc("GCP F5 XC Orchestration"):::f5xcStyle
    end

    %% vSphere Provider Subgraph
    subgraph "vSphere Provider"
        vsphere_f5xc("vSphere F5 XC Deployment"):::vsphereStyle
    end

    %% F5 XC Aggregated Orchestration
    subgraph "F5 XC Aggregation"
        aggregator("F5 XC Aggregation"):::f5xcStyle
    end

    %% Additional F5 XC Templates Subgraph
    subgraph "F5 XC Additional Templates"
        mesh_site("Secure Mesh Sites"):::templateStyle
        mesh_site_v2("Secure Mesh Sites v2"):::templateStyle
        status_mon("Status Monitoring"):::templateStyle
        voltstack("Voltstack Site"):::templateStyle
    end

    %% Utility Modules Subgraph
    subgraph "Utilities"
        util_kubeconfig("Kubeconfig Generation"):::utilStyle
        util_timeout("Timeout Handling"):::utilStyle
        util_update("Update Scripts"):::utilStyle
        util_maurice("Helper Functions"):::utilStyle
    end

    %% AWS Provider Relationships
    aws_vpc -->|"creates"| aws_subnets
    aws_subnets -->|"configures"| aws_sec
    aws_sec -->|"supports"| aws_netif
    aws_netif -->|"attaches to"| aws_ec2
    aws_ec2 -->|"monitors"| aws_instance_state
    aws_ec2 -->|"informs"| aws_f5xc
    aws_f5xc -->|"orchestrates"| aws_vpc

    %% Azure Provider Relationships
    az_rg -->|"hosts"| az_vnet
    az_vnet -->|"segments into"| az_subnet
    az_subnet -->|"secures"| az_sec
    az_sec -->|"enables"| az_linux
    az_linux -->|"reports to"| az_f5xc
    az_f5xc -->|"integrates with"| az_rg

    %% GCP Provider Relationships
    gcp_net -->|"provisions"| gcp_compute
    gcp_compute -->|"manages"| gcp_f5xc

    %% Aggregation of F5 XC Orchestration
    aws_f5xc --> aggregator
    az_f5xc --> aggregator
    gcp_f5xc --> aggregator
    vsphere_f5xc --> aggregator

    aggregator -->|"deploys"| mesh_site
    aggregator -->|"updates"| mesh_site_v2
    aggregator -->|"monitors"| status_mon
    aggregator -->|"configures"| voltstack

    %% Utilities Relationship (chained for clarity)
    util_kubeconfig -->|"triggers"| util_timeout
    util_timeout -->|"activates"| util_update
    util_update -->|"supports"| util_maurice

    %% Click Events
    click aws_vpc "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/aws/vpc/main.tf"
    click aws_subnets "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/aws/subnet/main.tf"
    click aws_sec "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/aws/security_group/main.tf"
    click aws_netif "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/aws/network_interface/main.tf"
    click aws_ec2 "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/aws/ec2/main.tf"
    click aws_instance_state "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/aws/instance_state/main.tf"
    click aws_f5xc "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/f5xc/ce/aws/main.tf"

    click az_rg "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/azure/resource_group/main.tf"
    click az_vnet "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/azure/virtual_network/main.tf"
    click az_subnet "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/azure/subnet/main.tf"
    click az_sec "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/azure/security_group/main.tf"
    click az_linux "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/azure/linux_virtual_machine/main.tf"
    click az_f5xc "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/f5xc/ce/azure/main.tf"

    click gcp_f5xc "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/f5xc/ce/gcp/main.tf"

    click vsphere_f5xc "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/f5xc/ce/vsphere/main.tf"

    click mesh_site "https://github.com/f5devcentral/f5-xc-tf-modules/tree/main/f5xc/secure_mesh_site"
    click mesh_site_v2 "https://github.com/f5devcentral/f5-xc-tf-modules/tree/main/f5xc/secure_mesh_site_v2"
    click status_mon "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/f5xc/status/site/main.tf"
    click voltstack "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/f5xc/voltstack_site/main.tf"

    click util_kubeconfig "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/utils/kubeconfig/main.tf"
    click util_timeout "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/utils/timeout/main.tf"
    click util_update "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/utils/update/main.tf"
    click util_maurice "https://github.com/f5devcentral/f5-xc-tf-modules/blob/main/utils/maurice/main.tf"

    %% Styles
    classDef awsStyle fill:#FFCCCC,stroke:#AA0000,stroke-width:2px;
    classDef azureStyle fill:#CCFFCC,stroke:#008800,stroke-width:2px;
    classDef gcpStyle fill:#CCCCFF,stroke:#000088,stroke-width:2px;
    classDef vsphereStyle fill:#FFFFCC,stroke:#888800,stroke-width:2px;
    classDef f5xcStyle fill:#FFEECC,stroke:#CC5500,stroke-width:2px;
    classDef templateStyle fill:#E0E0E0,stroke:#555555,stroke-width:2px;
    classDef utilStyle fill:#CCFFFF,stroke:#00AAAA,stroke-width:2px;
```
