# aldinkapetanovic/terraform-aws-ec2-ansible-microk8s architecture

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

- Interactive diagram: https://gitdiagram.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s
- Repository: https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s

## Overview

This repository provisions AWS-hosted MicroK8s infrastructure with Terraform and provides Ansible playbooks for preparing and configuring the cluster. The documented workflow is to apply Terraform, then run playbooks against an inventory; the README also describes remote kubeconfig access, the Kubernetes dashboard, and an optional Rancher installation. Source excerpts were unavailable, so links between individual configuration files and playbooks are omitted where their wiring cannot be confirmed.

Main entry points: [`README.md`](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/README.md) (Terraform apply), [`playbooks`](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/tree/main/playbooks) (MicroK8s cluster), [`provider.tf`](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/provider.tf) (AWS provider), [`instance.tf`](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/instance.tf) (EC2 instances)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_infra["AWS infrastructure"]
  node_terraform["Terraform apply<br/>[README.md]"]
  node_provider["AWS provider<br/>[provider.tf]"]
  node_instance["EC2 instances<br/>[instance.tf]"]
  node_key["SSH key<br/>[key.tf]"]
  node_inventory["Ansible inventory<br/>[inventory.tf]"]
  node_outputs["Terraform outputs<br/>[output.tf]"]
  node_vars["Variables<br/>[vars.tf]"]
  node_versions["Provider versions<br/>[versions.tf]"]
end

subgraph group_config["Cluster configuration"]
  node_upgrade["Upgrade host<br/>[upgrade.yml]"]
  node_reboot["Reboot host<br/>[reboot.yml]"]
  node_microk8s["Install MicroK8s<br/>[snap-microk8s.yml]"]
  node_packages["Additional packages"]
  node_zsh["Oh My Zsh<br/>[oh-my-zsh.yml]"]
  node_ssh["Configure SSH<br/>[ssh-key.yml]"]
  node_addons["Enable addons<br/>[enable-addons.yml]"]
  node_join["Join cluster<br/>[join.yml]"]
  node_cluster["MicroK8s cluster"]
end

subgraph group_access["Cluster access"]
  node_kubeconfig["Remote kubeconfig<br/>[README.md]"]
  node_dashboard["Dashboard access<br/>[README.md]"]
  node_rancher["Rancher install<br/>[README.md]"]
end

node_operator(("Operator"))
node_aws["AWS"]
node_helm["Helm chart repository"]

node_operator -->|"runs"| node_terraform
node_terraform -->|"uses"| node_provider
node_terraform -->|"applies"| node_instance
node_terraform -->|"applies"| node_key
node_terraform -->|"applies"| node_inventory
node_terraform -->|"reads"| node_outputs
node_terraform -->|"uses"| node_vars
node_terraform -->|"uses"| node_versions
node_provider -->|"connects"| node_aws
node_instance -->|"provisions"| node_aws
node_operator -->|"runs"| node_upgrade
node_operator -->|"runs"| node_reboot
node_operator -->|"runs"| node_microk8s
node_operator -->|"runs"| node_packages
node_operator -->|"runs"| node_zsh
node_operator -->|"runs"| node_ssh
node_operator -->|"runs"| node_addons
node_operator -->|"runs"| node_join
node_upgrade -->|"configures hosts"| node_cluster
node_reboot -->|"reboots hosts"| node_cluster
node_microk8s -->|"installs"| node_cluster
node_packages -->|"configures hosts"| node_cluster
node_zsh -->|"configures hosts"| node_cluster
node_ssh -->|"configures access"| node_cluster
node_addons -->|"enables addons"| node_cluster
node_join -->|"joins nodes"| node_cluster
node_operator -->|"retrieves"| node_kubeconfig
node_cluster -->|"provides config"| node_kubeconfig
node_operator -->|"port-forwards"| node_dashboard
node_operator -.->|"installs"| node_rancher
node_rancher -.->|"fetches chart"| node_helm

click node_terraform "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/README.md"
click node_provider "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/provider.tf"
click node_instance "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/instance.tf"
click node_key "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/key.tf"
click node_inventory "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/inventory.tf"
click node_outputs "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/output.tf"
click node_vars "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/vars.tf"
click node_versions "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/versions.tf"
click node_upgrade "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/upgrade.yml"
click node_reboot "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/reboot.yml"
click node_microk8s "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/snap-microk8s.yml"
click node_packages "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/additional-packages.yml"
click node_zsh "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/oh-my-zsh.yml"
click node_ssh "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/ssh-key.yml"
click node_addons "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/enable-addons.yml"
click node_join "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/join.yml"
click node_cluster "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/tree/main/playbooks"
click node_kubeconfig "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/README.md"
click node_dashboard "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/README.md"
click node_rancher "https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/README.md"

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_terraform,node_provider,node_instance,node_key,node_inventory,node_outputs,node_vars,node_versions toneBlue
class node_upgrade,node_reboot,node_microk8s,node_packages,node_zsh,node_ssh,node_addons,node_join,node_cluster toneAmber
class node_kubeconfig,node_dashboard,node_rancher toneMint
class node_operator,node_aws,node_helm toneIndigo
```

## Components

### AWS infrastructure

- [Terraform apply](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/README.md): `README.md`
- [AWS provider](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/provider.tf): `provider.tf`
- [EC2 instances](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/instance.tf): `instance.tf`
- [SSH key](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/key.tf): `key.tf`
- [Ansible inventory](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/inventory.tf): `inventory.tf`
- [Terraform outputs](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/output.tf): `output.tf`
- [Variables](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/vars.tf): `vars.tf`
- [Provider versions](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/versions.tf): `versions.tf`

### Cluster configuration

- [Upgrade host](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/upgrade.yml): `playbooks/upgrade.yml`
- [Reboot host](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/reboot.yml): `playbooks/reboot.yml`
- [Install MicroK8s](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/snap-microk8s.yml): `playbooks/snap-microk8s.yml`
- [Additional packages](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/additional-packages.yml): `playbooks/additional-packages.yml`
- [Oh My Zsh](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/oh-my-zsh.yml): `playbooks/oh-my-zsh.yml`
- [Configure SSH](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/ssh-key.yml): `playbooks/ssh-key.yml`
- [Enable addons](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/enable-addons.yml): `playbooks/enable-addons.yml`
- [Join cluster](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/playbooks/join.yml): `playbooks/join.yml`
- [MicroK8s cluster](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/tree/main/playbooks): `playbooks`

### Cluster access

- [Remote kubeconfig](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/README.md): `README.md`
- [Dashboard access](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/README.md): `README.md`
- [Rancher install](https://github.com/aldinkapetanovic/terraform-aws-ec2-ansible-microk8s/blob/main/README.md): `README.md`

### Other components

- **Operator**
- **AWS**
- **Helm chart repository**

## Connections

- Operator → Terraform apply: runs
- Terraform apply → AWS provider: uses
- Terraform apply → EC2 instances: applies
- Terraform apply → SSH key: applies
- Terraform apply → Ansible inventory: applies
- Terraform apply → Terraform outputs: reads
- Terraform apply → Variables: uses
- Terraform apply → Provider versions: uses
- AWS provider → AWS: connects
- EC2 instances → AWS: provisions
- Operator → Upgrade host: runs
- Operator → Reboot host: runs
- Operator → Install MicroK8s: runs
- Operator → Additional packages: runs
- Operator → Oh My Zsh: runs
- Operator → Configure SSH: runs
- Operator → Enable addons: runs
- Operator → Join cluster: runs
- Upgrade host → MicroK8s cluster: configures hosts
- Reboot host → MicroK8s cluster: reboots hosts
- Install MicroK8s → MicroK8s cluster: installs
- Additional packages → MicroK8s cluster: configures hosts
- Oh My Zsh → MicroK8s cluster: configures hosts
- Configure SSH → MicroK8s cluster: configures access
- Enable addons → MicroK8s cluster: enables addons
- Join cluster → MicroK8s cluster: joins nodes
- Operator → Remote kubeconfig: retrieves
- MicroK8s cluster → Remote kubeconfig: provides config
- Operator → Dashboard access: port-forwards
- Operator → Rancher install: installs
- Rancher install → Helm chart repository: fetches chart
