# kevanto/terraform-aws-ps-sso architecture

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

- Interactive diagram: https://gitdiagram.com/kevanto/terraform-aws-ps-sso
- Repository: https://github.com/kevanto/terraform-aws-ps-sso

## Overview

This repository provisions infrastructure for running K3s on an EC2 instance. The documented workflow is to configure remote state, run Terraform initialization and apply, then SSH to the instance and retrieve its kubeconfig. The file tree identifies Terraform configuration and setup scripts, but no source excerpts show their resource details or interactions; those relationships are therefore marked unverified where included.

Main entry points: [`k3s-server.tf`](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/k3s-server.tf) (K3s EC2 server), [`k3s-server-script.sh`](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/k3s-server-script.sh) (Server setup script), [`install-helm.sh`](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/install-helm.sh) (Helm installation script), [`backend.tf`](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/backend.tf) (State backend config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_terraform["Terraform configuration"]
  node_backend["State backend config<br/>[backend.tf]"]
  node_provider["AWS provider config<br/>[provider.tf]"]
  node_variables["Input variables<br/>[variables.tf]"]
  node_network["VPC networking<br/>[vpc.tf]"]
  node_instance["K3s EC2 server<br/>[k3s-server.tf]"]
  node_outputs["Deployment outputs<br/>[outputs.tf]"]
end

subgraph group_setup["Instance setup"]
  node_server_script["Server setup script"]
  node_helm_script["Helm installation script<br/>[install-helm.sh]"]
  node_k3s["K3s cluster"]
end

subgraph group_access["Cluster access"]
  node_ssh["SSH session"]
  node_kubeconfig["Kubeconfig"]
end

node_operator(("Operator"))
node_terraform_cli["Terraform CLI"]
node_aws["AWS"]

node_operator -->|"runs init and apply"| node_terraform_cli
node_operator -->|"sets remote state"| node_backend
node_terraform_cli -.->|"provisions"| node_instance
node_terraform_cli -.->|"provisions"| node_network
node_terraform_cli -.->|"deploys to"| node_aws
node_instance -.->|"runs setup"| node_server_script
node_server_script -.->|"installs"| node_k3s
node_operator -->|"connects by SSH"| node_ssh
node_ssh -->|"reads"| node_kubeconfig
node_k3s -->|"provides"| node_kubeconfig
node_helm_script -.->|"configures Helm"| node_k3s

click node_backend "https://github.com/kevanto/terraform-aws-ps-sso/blob/main/backend.tf"
click node_provider "https://github.com/kevanto/terraform-aws-ps-sso/blob/main/provider.tf"
click node_variables "https://github.com/kevanto/terraform-aws-ps-sso/blob/main/variables.tf"
click node_network "https://github.com/kevanto/terraform-aws-ps-sso/blob/main/vpc.tf"
click node_instance "https://github.com/kevanto/terraform-aws-ps-sso/blob/main/k3s-server.tf"
click node_outputs "https://github.com/kevanto/terraform-aws-ps-sso/blob/main/outputs.tf"
click node_server_script "https://github.com/kevanto/terraform-aws-ps-sso/blob/main/k3s-server-script.sh"
click node_helm_script "https://github.com/kevanto/terraform-aws-ps-sso/blob/main/install-helm.sh"

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_backend,node_provider,node_variables,node_network,node_instance,node_outputs toneBlue
class node_server_script,node_helm_script,node_k3s toneAmber
class node_ssh,node_kubeconfig toneMint
class node_operator,node_terraform_cli,node_aws toneIndigo
```

## Components

### Terraform configuration

- [State backend config](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/backend.tf): `backend.tf`
- [AWS provider config](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/provider.tf): `provider.tf`
- [Input variables](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/variables.tf): `variables.tf`
- [VPC networking](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/vpc.tf): `vpc.tf`
- [K3s EC2 server](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/k3s-server.tf): `k3s-server.tf`
- [Deployment outputs](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/outputs.tf): `outputs.tf`

### Instance setup

- [Server setup script](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/k3s-server-script.sh): `k3s-server-script.sh`
- [Helm installation script](https://github.com/kevanto/terraform-aws-ps-sso/blob/main/install-helm.sh): `install-helm.sh`
- **K3s cluster**

### Cluster access

- **SSH session**
- **Kubeconfig**

### Other components

- **Operator**
- **Terraform CLI**
- **AWS**

## Connections

- Operator → Terraform CLI: runs init and apply (evidence: `README.md`)
- Operator → State backend config: sets remote state (evidence: `README.md`)
- Terraform CLI → K3s EC2 server: provisions
- Terraform CLI → VPC networking: provisions
- Terraform CLI → AWS: deploys to
- K3s EC2 server → Server setup script: runs setup
- Server setup script → K3s cluster: installs
- Operator → SSH session: connects by SSH (evidence: `README.md`)
- SSH session → Kubeconfig: reads (evidence: `README.md`)
- K3s cluster → Kubeconfig: provides (evidence: `README.md`)
- Helm installation script → K3s cluster: configures Helm
