# william-hashicorp/multi-product-integration-demo architecture

> Architecture diagram of the GitHub repository william-hashicorp/multi-product-integration-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/william-hashicorp/multi-product-integration-demo
- Repository: https://github.com/william-hashicorp/multi-product-integration-demo

## Overview

##### Main Components
- Control Workspace: Represented by the “0_control-workspace”. This is the central orchestrator that triggers/delegates the deployment to all the downstream workspaces.
- Networking: The “1_networking” module sets up core networking (AWS VPC, HCP HVN, and peering).
- HCP Clusters: The “2_hcp-clusters” provisions service clusters for Vault, Boundary, and Consul.
- Vault Authentication: “3_vault-auth-config” bootstraps Vault configuration and enables JWT/OIDC trust with Terraform Cloud.
- Boundary Configuration: “4_boundary-config” and “8_boundary-adv” handle Boundary’s dynamic host sets and later additional user/group/role management.
- Nomad Clusters/Nodes: “5_nomad-cluster” provisions the Nomad server cluster, while “6_nomad-nodes” provisions client nodes (with separate node pools for x86 and ARM).
- Workload Deployment: “7_workload” deploys Nomad jobs (e.g., MongoDB, frontend application) and demonstrates dynamic credential injection from Vault as well as leveraging Consul Connect.
- Azure AD Integration: “10_aad_management” shows the integration for Just-in-Time Access using Azure AD.
- Additional Testing/Boundary: “11_boundary_test” might be used for testing Boundary configurations.
- Packer: The “packer” directory holds the Packer templates to build Nomad server/client AMIs.
- Doormat-Prereqs: The “doormat-prereqs” directory holds scripts and configs to prepare AWS accounts and credentials for using the doormat provider on TFC.

##### Relationships and Interactions
- Networking module as the foundation that provides connectivity between AWS and HCP.
- HCP Clusters as providing core security and service discovery with Vault, Boundary, and Consul.
- That the Vault configuration module not only authenticates Terraform Cloud but further integrates dynamic credential generation, which is consumed by Nomad jobs in the Workload module.
- Demonstrate that Boundary interacts with both Vault (for SSH signed certificate injection) and the Nomad clusters (to manage dynamic host sets for secure access).
- Point out that Packer is used to build Nomad AMIs, feeding into the Nomad cluster deployment.
- That Doormat-Prereqs provide initial setup for AWS credentials and environment preparation.
- Possibly include Terraform Cloud (TFC) as an external dependency/platform that orchestrates these workspaces and manages variable sets (as seen in the README instructions).

##### Architectural Patterns and Design Principles
- Modular Infrastructure as Code (IaC): Each numbered directory (e.g., 0_control-workspace, 1_networking, etc.) is an independent module/workspace that contributes to the overall environment.
- Orchestration via Terraform: The control workspace is a “parent” that triggers workspaces downstream, which exemplifies multi-space orchestration.
- Service Integration: Emphasize the integration of HashiCorp’s suite (Vault, Boundary, Consul, Nomad) and the corresponding external systems (AWS networking, Azure AD).
- Consistent Resource Naming and Tagging: Many modules use variables (for stack_id, region, etc.) to ensure names and resources are deployed consistently.

##### Step-by-Step Recommendations for the Principal Software Engineer
a. Begin by drawing a high-level layout where the Control Workspace is the central coordinator.
b. Branch out to the key modules—Networking, HCP Clusters, Vault Auth, Boundary Config, Nomad Cluster/Nodes, Workload, and any additional aspects like Azure AD and doormat-prereqs.
d. External interactions: e.g., AWS infrastructure, communication with HCP services, authentication via TFC, and integration with Azure AD.
e. Finally, review the README sections to ensure you capture integration points (such as the dynamic MongoDB credentials refresh in the Nomad jobs and the SSH certificate injection in Boundary).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Orchestration Layer
    subgraph "Orchestration"
        A["Control Workspace (0_control-workspace)"]:::orchestration
        D["Doormat-Prereqs (doormat-prereqs)"]:::orchestration
    end

    %% Infrastructure Provisioning Layer
    subgraph "Infrastructure Provisioning"
        B["Networking (1_networking)"]:::infrastructure
        C["HCP Clusters (2_hcp-clusters)"]:::infrastructure
        I["Packer Templates (packer)"]:::infrastructure
        F["Nomad Clusters (Server) (5_nomad-cluster)"]:::infrastructure
        G["Nomad Nodes (Clients) (6_nomad-nodes)"]:::infrastructure
    end

    %% Security & Access Layer
    subgraph "Security & Access"
        E["Vault Authentication (3_vault-auth-config)"]:::security
        H["Boundary Configuration (4_boundary-config)"]:::security
        J["Additional Boundary Config (8_boundary-adv)"]:::security
        K["Azure AD Integration (10_aad_management)"]:::security
        L["Boundary Testing (11_boundary_test)"]:::security
    end

    %% Workload Orchestration Layer
    subgraph "Workload Orchestration"
        M["Workload Deployment (7_workload)"]:::workload
    end

    %% External Dependencies
    AWS["AWS Infrastructure"]:::external
    HCP["HashiCorp Cloud Platform (HCP)"]:::external
    TFC["Terraform Cloud (TFC)"]:::external

    %% Connections from Control Workspace to Modules
    A -->|"triggers"| D
    A -->|"triggers"| B
    A -->|"triggers"| C
    A -->|"triggers"| E
    A -->|"triggers"| H
    A -->|"triggers"| F
    A -->|"triggers"| M
    A -->|"triggers"| K
    A -->|"triggers"| L

    %% Infrastructure Provisioning Flows
    B -->|"sets-up"| AWS
    B -->|"sets-up"| HCP
    C -->|"provisions"| HCP
    I -->|"builds AMIs for"| F
    F -->|"controls"| G

    %% Security & Access Interactions
    C -->|"provides VaultCluster"| E
    C -->|"provides BoundaryCluster"| H
    E -->|"supplies credentials to"| M
    H -->|"configures hosts for"| F
    J -->|"extends"| H
    L -->|"tests"| H
    K -->|"integrates JIT access with"| TFC

    %% Doormat and External Integration
    D -->|"prepares AWS creds for"| TFC

    %% Workload Deployment
    M -->|"deploys jobs on"| F

    %% Styles
    classDef orchestration fill:#FFCC99,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef security fill:#C1FFC1,stroke:#333,stroke-width:2px;
    classDef workload fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef external fill:#FFFACD,stroke:#333,stroke-width:2px;

    %% Click Events
    click A "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/0_control-workspace/"
    click D "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/doormat-prereqs/"
    click B "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/1_networking/"
    click C "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/2_hcp-clusters/"
    click E "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/3_vault-auth-config/"
    click H "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/4_boundary-config/"
    click F "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/5_nomad-cluster/"
    click G "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/6_nomad-nodes/"
    click M "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/7_workload/"
    click J "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/8_boundary-adv/"
    click K "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/10_aad_management/"
    click L "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/11_boundary_test/"
    click I "https://github.com/william-hashicorp/multi-product-integration-demo/tree/main/packer/"
```
