# devsecopsg/terraformcode architecture

> Architecture diagram of the GitHub repository devsecopsg/terraformcode, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devsecopsg/terraformcode
- Repository: https://github.com/devsecopsg/terraformcode

## Overview

#### Purpose and entry point
This is a Terraform infrastructure repository for provisioning AWS resources. The root composition point is `main.tf`, which likely coordinates independent infrastructure modules for networking, compute, Kubernetes, storage, and user setup.

#### Root orchestration
`main.tf` is the primary Terraform entry point. It defines or invokes the repository’s top-level infrastructure graph and establishes dependencies among the AWS resource domains.

Relevant path:
- `main.tf`

#### Networking foundation
The VPC layer provides the network boundary required by compute and Kubernetes workloads. It is implemented independently so downstream resources can consume VPC, subnet, route, or security-related outputs.

Relevant path:
- `vpc/main.tf`

#### EC2 compute
The EC2 component provisions standalone AWS virtual-machine compute. It likely consumes networking defined by the VPC layer and may represent bastion, application, or administrative hosts separate from Kubernetes.

Relevant path:
- `ec2/main.tf`

#### EKS Kubernetes platform
The EKS component provisions an Amazon Elastic Kubernetes Service environment. It is a major workload platform and should depend on networking resources and AWS IAM permissions/roles where configured. Its local documentation indicates EKS-specific operational context.

Relevant paths:
- `eks/main.tf`
- `eks/readme.md`

#### S3 storage
The S3 component provisions AWS object storage. It is isolated as a distinct infrastructure concern and may serve application artifacts, backups, data storage, or Terraform-adjacent state patterns depending on its resource definitions.

Relevant path:
- `s3/main.tf`

#### Identity/bootstrap users
The create-user component handles AWS identity or user bootstrap resources. This is an access-control boundary and may need to exist before services or operators can access provisioned infrastructure.

Relevant path:
- `createuser/main.tf`

#### Runtime and external boundary
Terraform is the execution runtime; AWS is the external cloud control plane. Applying the root configuration causes Terraform to create and reconcile AWS networking, EC2, EKS, S3, and identity resources. The principal flow is: root Terraform orchestration → foundational IAM/network setup → compute and EKS provisioning → storage and operational access resources, subject to dependencies encoded in the `.tf` files.

Main entry points: [`main.tf`](https://github.com/devsecopsg/terraformcode/blob/main/main.tf) (Root orchestration), [`eks/main.tf`](https://github.com/devsecopsg/terraformcode/blob/main/eks/main.tf) (EKS platform), [`vpc/main.tf`](https://github.com/devsecopsg/terraformcode/blob/main/vpc/main.tf) (VPC networking), [`createuser/main.tf`](https://github.com/devsecopsg/terraformcode/blob/main/createuser/main.tf) (Identity bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_terraform["Terraform configuration"]
  node_root["Root orchestration<br/>Terraform root<br/>[main.tf]"]
  node_vpc["VPC networking<br/>Terraform module<br/>[main.tf]"]
  node_ec2["EC2 compute<br/>Terraform module<br/>[main.tf]"]
  node_eks["EKS platform<br/>Terraform module<br/>[main.tf]"]
  node_eks_docs["EKS operations guide<br/>documentation<br/>[readme.md]"]
  node_s3["S3 storage<br/>Terraform module<br/>[main.tf]"]
  node_users["Identity bootstrap<br/>Terraform module<br/>[main.tf]"]
end

subgraph group_aws["AWS resources"]
  node_aws_network["Network resources<br/>AWS networking"]
  node_aws_ec2["EC2 instances<br/>AWS compute"]
  node_aws_eks["EKS cluster<br/>AWS Kubernetes"]
  node_aws_s3[("S3 buckets<br/>AWS storage")]
  node_aws_iam["IAM users and roles<br/>AWS identity"]
end

node_terraform{{"Terraform runtime<br/>IaC runtime"}}
node_aws{{"AWS control plane<br/>cloud provider"}}

node_terraform -->|"executes"| node_root
node_root -->|"composes"| node_vpc
node_root -->|"composes"| node_users
node_root -->|"composes"| node_ec2
node_root -->|"composes"| node_eks
node_root -->|"composes"| node_s3
node_vpc -->|"network dependency"| node_ec2
node_vpc -->|"network dependency"| node_eks
node_users -.->|"IAM dependency"| node_eks
node_eks_docs -.->|"documents"| node_eks
node_vpc -->|"provisions"| node_aws_network
node_ec2 -->|"provisions"| node_aws_ec2
node_eks -->|"provisions"| node_aws_eks
node_s3 -->|"provisions"| node_aws_s3
node_users -->|"provisions"| node_aws_iam
node_aws_iam -.->|"cluster permissions"| node_aws_eks
node_aws_network -->|"hosts"| node_aws_ec2
node_aws_network -->|"hosts"| node_aws_eks
node_aws -->|"provides"| node_aws_network
node_aws -->|"provides"| node_aws_ec2
node_aws -->|"provides"| node_aws_eks
node_aws -->|"provides"| node_aws_s3
node_aws -->|"provides"| node_aws_iam

click node_root "https://github.com/devsecopsg/terraformcode/blob/main/main.tf"
click node_vpc "https://github.com/devsecopsg/terraformcode/blob/main/vpc/main.tf"
click node_ec2 "https://github.com/devsecopsg/terraformcode/blob/main/ec2/main.tf"
click node_eks "https://github.com/devsecopsg/terraformcode/blob/main/eks/main.tf"
click node_eks_docs "https://github.com/devsecopsg/terraformcode/blob/main/eks/readme.md"
click node_s3 "https://github.com/devsecopsg/terraformcode/blob/main/s3/main.tf"
click node_users "https://github.com/devsecopsg/terraformcode/blob/main/createuser/main.tf"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_root,node_vpc,node_ec2,node_eks,node_eks_docs,node_s3,node_users toneBlue
class node_aws_network,node_aws_ec2,node_aws_eks,node_aws_s3,node_aws_iam toneAmber
class node_terraform,node_aws toneNeutral
```

## Components

### Terraform configuration

- [Root orchestration](https://github.com/devsecopsg/terraformcode/blob/main/main.tf): Terraform root · Composes the top-level infrastructure graph. · `main.tf`
- [VPC networking](https://github.com/devsecopsg/terraformcode/blob/main/vpc/main.tf): Terraform module · Provides the network boundary and downstream network outputs. · `vpc/main.tf`
- [EC2 compute](https://github.com/devsecopsg/terraformcode/blob/main/ec2/main.tf): Terraform module · Provisions standalone virtual-machine compute. · `ec2/main.tf`
- [EKS platform](https://github.com/devsecopsg/terraformcode/blob/main/eks/main.tf): Terraform module · Provisions the Kubernetes workload platform. · `eks/main.tf`
- [EKS operations guide](https://github.com/devsecopsg/terraformcode/blob/main/eks/readme.md): documentation · EKS-specific operational context. · `eks/readme.md`
- [S3 storage](https://github.com/devsecopsg/terraformcode/blob/main/s3/main.tf): Terraform module · Provisions object storage. · `s3/main.tf`
- [Identity bootstrap](https://github.com/devsecopsg/terraformcode/blob/main/createuser/main.tf): Terraform module · Provisions AWS identity or user access resources. · `createuser/main.tf`

### AWS resources

- **Network resources**: AWS networking
- **EC2 instances**: AWS compute
- **EKS cluster**: AWS Kubernetes
- **S3 buckets**: AWS storage
- **IAM users and roles**: AWS identity

### Other components

- **Terraform runtime**: IaC runtime · Plans and applies the root configuration.
- **AWS control plane**: cloud provider · Reconciles the requested cloud resources.

## Connections

- Terraform runtime → Root orchestration: executes
- Root orchestration → VPC networking: composes
- Root orchestration → Identity bootstrap: composes
- Root orchestration → EC2 compute: composes
- Root orchestration → EKS platform: composes
- Root orchestration → S3 storage: composes
- VPC networking → EC2 compute: network dependency
- VPC networking → EKS platform: network dependency
- Identity bootstrap → EKS platform: IAM dependency
- EKS operations guide → EKS platform: documents
- VPC networking → Network resources: provisions
- EC2 compute → EC2 instances: provisions
- EKS platform → EKS cluster: provisions
- S3 storage → S3 buckets: provisions
- Identity bootstrap → IAM users and roles: provisions
- IAM users and roles → EKS cluster: cluster permissions
- Network resources → EC2 instances: hosts
- Network resources → EKS cluster: hosts
- AWS control plane → Network resources: provides
- AWS control plane → EC2 instances: provides
- AWS control plane → EKS cluster: provides
- AWS control plane → S3 buckets: provides
- AWS control plane → IAM users and roles: provides
