# terraform-aws-modules/terraform-aws-alb architecture

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

- Interactive diagram: https://gitdiagram.com/terraform-aws-modules/terraform-aws-alb
- Repository: https://github.com/terraform-aws-modules/terraform-aws-alb
- Video tour (about a minute): https://gitdiagram.com/terraform-aws-modules/terraform-aws-alb/video

## Overview

This is a Terraform module for provisioning AWS Application or Network Load Balancers. A Terraform configuration supplies network, security, listener, and target-group settings; the module provisions the load-balancing resources and exposes outputs. The README documents ALB routing and authentication, NLB listener protocols, security groups, and access logs. The tree also contains a trust-store submodule and a wrapper. Source excerpts were unavailable, so links beyond the README-documented provisioning behavior are omitted.

Main entry points: [`main.tf`](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf) (ALB/NLB Module), [`variables.tf`](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/variables.tf) (Module Inputs), [`outputs.tf`](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/outputs.tf) (Module Outputs), [`wrappers/main.tf`](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/wrappers/main.tf) (Module Wrapper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Load Balancer Module"]
  node_root["ALB/NLB Module<br/>[main.tf]"]
  node_inputs["Module Inputs<br/>[variables.tf]"]
  node_outputs["Module Outputs<br/>[outputs.tf]"]
  node_loadbalancer["Load Balancer<br/>[main.tf]"]
end

subgraph group_routing["Traffic Routing"]
  node_listeners["Listeners<br/>[main.tf]"]
  node_listener_rules["Listener Rules<br/>[main.tf]"]
  node_target_groups["Target Groups<br/>[main.tf]"]
end

subgraph group_security["Security and Logs"]
  node_security_groups["Security Groups<br/>[main.tf]"]
  node_access_logs["Access Logs<br/>[main.tf]"]
end

subgraph group_extensions["Module Extensions"]
  node_trust_store["Load Balancer Trust Store<br/>[main.tf]"]
  node_wrapper["Module Wrapper<br/>[main.tf]"]
end

node_caller(("Terraform Caller"))
node_aws_elb["AWS Load Balancing"]
node_targets["Backend Targets"]
node_log_bucket[("S3 Log Bucket")]
node_cognito["Cognito Authentication"]
node_oidc["OIDC Provider"]

node_caller -->|"sets configuration"| node_inputs
node_inputs -->|"configures"| node_root
node_root -->|"creates"| node_loadbalancer
node_loadbalancer -->|"provisions"| node_aws_elb
node_root -->|"creates"| node_listeners
node_root -->|"creates"| node_target_groups
node_listeners -->|"evaluates"| node_listener_rules
node_listener_rules -->|"forwards to"| node_target_groups
node_target_groups -->|"routes to"| node_targets
node_root -->|"creates"| node_security_groups
node_root -->|"configures"| node_access_logs
node_access_logs -->|"writes logs"| node_log_bucket
node_listeners -.->|"authenticates with"| node_cognito
node_listener_rules -.->|"authenticates with"| node_oidc
node_root -->|"exposes results"| node_outputs
node_caller -.->|"uses wrapper"| node_wrapper

click node_root "https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf"
click node_inputs "https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/variables.tf"
click node_outputs "https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/outputs.tf"
click node_loadbalancer "https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf"
click node_listeners "https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf"
click node_listener_rules "https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf"
click node_target_groups "https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf"
click node_security_groups "https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf"
click node_access_logs "https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf"
click node_trust_store "https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/modules/lb_trust_store/main.tf"
click node_wrapper "https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/wrappers/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_inputs,node_outputs,node_loadbalancer toneBlue
class node_listeners,node_listener_rules,node_target_groups,node_log_bucket toneAmber
class node_security_groups,node_access_logs toneMint
class node_trust_store,node_wrapper toneRose
class node_caller,node_aws_elb,node_targets,node_cognito,node_oidc toneIndigo
```

## Components

### Load Balancer Module

- [ALB/NLB Module](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf): `main.tf`
- [Module Inputs](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/variables.tf): `variables.tf`
- [Module Outputs](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/outputs.tf): `outputs.tf`
- [Load Balancer](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf): `main.tf`

### Traffic Routing

- [Listeners](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf): `main.tf`
- [Listener Rules](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf): `main.tf`
- [Target Groups](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf): `main.tf`

### Security and Logs

- [Security Groups](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf): `main.tf`
- [Access Logs](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/main.tf): `main.tf`

### Module Extensions

- [Load Balancer Trust Store](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/modules/lb_trust_store/main.tf): `modules/lb_trust_store/main.tf`
- [Module Wrapper](https://github.com/terraform-aws-modules/terraform-aws-alb/blob/master/wrappers/main.tf): `wrappers/main.tf`

### Other components

- **Terraform Caller**
- **AWS Load Balancing**
- **Backend Targets**
- **S3 Log Bucket**
- **Cognito Authentication**
- **OIDC Provider**

## Connections

- Terraform Caller → Module Inputs: sets configuration
- Module Inputs → ALB/NLB Module: configures
- ALB/NLB Module → Load Balancer: creates
- Load Balancer → AWS Load Balancing: provisions
- ALB/NLB Module → Listeners: creates
- ALB/NLB Module → Target Groups: creates
- Listeners → Listener Rules: evaluates
- Listener Rules → Target Groups: forwards to
- Target Groups → Backend Targets: routes to
- ALB/NLB Module → Security Groups: creates
- ALB/NLB Module → Access Logs: configures
- Access Logs → S3 Log Bucket: writes logs
- Listeners → Cognito Authentication: authenticates with
- Listener Rules → OIDC Provider: authenticates with
- ALB/NLB Module → Module Outputs: exposes results
- Terraform Caller → Module Wrapper: uses wrapper
