# myselfag/terraansibleops architecture

> Architecture diagram of the GitHub repository myselfag/terraansibleops, 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/myselfag/terraansibleops
- Repository: https://github.com/myselfag/terraansibleops

## Overview

This repository automates AWS infrastructure provisioning and server configuration with Terraform and Ansible. The intended workflow is to provision resources, produce host information, then configure hosts through Ansible; the inventory script explicitly reads inventory.json and writes Ansible’s hosts.ini. The README is only a title, and the workflow and Terraform/Ansible sources were not sampled, so links involving their orchestration and resource relationships are limited to what the tree and sampled script support.

Main entry points: [`Ansible/playbooks/site.yml`](https://github.com/myselfag/terraansibleops/blob/main/Ansible/playbooks/site.yml) (Ansible site play), [`Terraform/main.tf`](https://github.com/myselfag/terraansibleops/blob/main/Terraform/main.tf) (Terraform root), [`.github/workflows/terraform-ansible.yml`](https://github.com/myselfag/terraansibleops/blob/main/.github/workflows/terraform-ansible.yml) (Deployment workflow), [`script/inventory.py`](https://github.com/myselfag/terraansibleops/blob/main/script/inventory.py) (Inventory generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_provision["Infrastructure"]
  node_workflow["Deployment workflow"]
  node_terraform["Terraform root<br/>[main.tf]"]
  node_ec2["EC2 resources<br/>[ec2.tf]"]
  node_s3["S3 resources<br/>[s3.tf]"]
  node_dynamodb["DynamoDB resources<br/>[dynamodb.tf]"]
  node_backend[("Remote state<br/>[terraform.tf]")]
  node_outputs["Terraform outputs<br/>[output.tf]"]
end

subgraph group_inventory["Host inventory"]
  node_inventory_data["inventory.json"]
  node_generator["Inventory generator<br/>[inventory.py]"]
  node_hosts["Ansible hosts<br/>[hosts.ini]"]
end

subgraph group_configure["Configuration"]
  node_site["Ansible site play<br/>[site.yml]"]
  node_common["Common role<br/>[main.yml]"]
  node_firewall["Firewall role<br/>[main.yml]"]
  node_ssh["SSH role<br/>[main.yml]"]
  node_apache["Apache role<br/>[main.yml]"]
  node_nginx["Nginx role<br/>[main.yml]"]
end

node_operator(("Operator"))
node_aws[("AWS")]
node_servers["Target servers"]

node_operator -->|"triggers"| node_workflow
node_workflow -->|"runs"| node_terraform
node_terraform -->|"defines"| node_ec2
node_terraform -->|"defines"| node_s3
node_terraform -->|"defines"| node_dynamodb
node_terraform -->|"uses state"| node_backend
node_terraform -->|"exposes"| node_outputs
node_ec2 -->|"provisions"| node_aws
node_s3 -->|"provisions"| node_aws
node_dynamodb -->|"provisions"| node_aws
node_inventory_data -->|"reads"| node_generator
node_generator -->|"writes"| node_hosts
node_workflow -->|"runs"| node_generator
node_workflow -->|"runs"| node_site
node_site -->|"targets"| node_hosts
node_site -->|"applies"| node_common
node_site -->|"applies"| node_firewall
node_site -->|"applies"| node_ssh
node_site -->|"applies"| node_apache
node_site -->|"applies"| node_nginx
node_site -->|"configures"| node_servers

click node_workflow "https://github.com/myselfag/terraansibleops/blob/main/.github/workflows/terraform-ansible.yml"
click node_terraform "https://github.com/myselfag/terraansibleops/blob/main/Terraform/main.tf"
click node_ec2 "https://github.com/myselfag/terraansibleops/blob/main/Terraform/modules/ec2.tf"
click node_s3 "https://github.com/myselfag/terraansibleops/blob/main/Terraform/modules/s3.tf"
click node_dynamodb "https://github.com/myselfag/terraansibleops/blob/main/Terraform/modules/dynamodb.tf"
click node_backend "https://github.com/myselfag/terraansibleops/blob/main/Terraform/remote-backend/terraform.tf"
click node_outputs "https://github.com/myselfag/terraansibleops/blob/main/Terraform/output.tf"
click node_generator "https://github.com/myselfag/terraansibleops/blob/main/script/inventory.py"
click node_hosts "https://github.com/myselfag/terraansibleops/blob/main/Ansible/inventory/hosts.ini"
click node_site "https://github.com/myselfag/terraansibleops/blob/main/Ansible/playbooks/site.yml"
click node_common "https://github.com/myselfag/terraansibleops/blob/main/Ansible/roles/common/tasks/main.yml"
click node_firewall "https://github.com/myselfag/terraansibleops/blob/main/Ansible/roles/firewall/tasks/main.yml"
click node_ssh "https://github.com/myselfag/terraansibleops/blob/main/Ansible/roles/ssh/tasks/main.yml"
click node_apache "https://github.com/myselfag/terraansibleops/blob/main/Ansible/roles/apache/tasks/main.yml"
click node_nginx "https://github.com/myselfag/terraansibleops/blob/main/Ansible/roles/nginx/tasks/main.yml"

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_workflow,node_terraform,node_ec2,node_s3,node_dynamodb,node_backend,node_outputs toneBlue
class node_inventory_data,node_generator,node_hosts,node_aws toneAmber
class node_site,node_common,node_firewall,node_ssh,node_apache,node_nginx,node_servers toneMint
class node_operator toneIndigo
```

## Components

### Infrastructure

- [Deployment workflow](https://github.com/myselfag/terraansibleops/blob/main/.github/workflows/terraform-ansible.yml): `.github/workflows/terraform-ansible.yml`
- [Terraform root](https://github.com/myselfag/terraansibleops/blob/main/Terraform/main.tf): `Terraform/main.tf`
- [EC2 resources](https://github.com/myselfag/terraansibleops/blob/main/Terraform/modules/ec2.tf): `Terraform/modules/ec2.tf`
- [S3 resources](https://github.com/myselfag/terraansibleops/blob/main/Terraform/modules/s3.tf): `Terraform/modules/s3.tf`
- [DynamoDB resources](https://github.com/myselfag/terraansibleops/blob/main/Terraform/modules/dynamodb.tf): `Terraform/modules/dynamodb.tf`
- [Remote state](https://github.com/myselfag/terraansibleops/blob/main/Terraform/remote-backend/terraform.tf): `Terraform/remote-backend/terraform.tf`
- [Terraform outputs](https://github.com/myselfag/terraansibleops/blob/main/Terraform/output.tf): `Terraform/output.tf`

### Host inventory

- **inventory.json**
- [Inventory generator](https://github.com/myselfag/terraansibleops/blob/main/script/inventory.py): `script/inventory.py`
- [Ansible hosts](https://github.com/myselfag/terraansibleops/blob/main/Ansible/inventory/hosts.ini): `Ansible/inventory/hosts.ini`

### Configuration

- [Ansible site play](https://github.com/myselfag/terraansibleops/blob/main/Ansible/playbooks/site.yml): `Ansible/playbooks/site.yml`
- [Common role](https://github.com/myselfag/terraansibleops/blob/main/Ansible/roles/common/tasks/main.yml): `Ansible/roles/common/tasks/main.yml`
- [Firewall role](https://github.com/myselfag/terraansibleops/blob/main/Ansible/roles/firewall/tasks/main.yml): `Ansible/roles/firewall/tasks/main.yml`
- [SSH role](https://github.com/myselfag/terraansibleops/blob/main/Ansible/roles/ssh/tasks/main.yml): `Ansible/roles/ssh/tasks/main.yml`
- [Apache role](https://github.com/myselfag/terraansibleops/blob/main/Ansible/roles/apache/tasks/main.yml): `Ansible/roles/apache/tasks/main.yml`
- [Nginx role](https://github.com/myselfag/terraansibleops/blob/main/Ansible/roles/nginx/tasks/main.yml): `Ansible/roles/nginx/tasks/main.yml`

### Other components

- **Operator**
- **AWS**
- **Target servers**

## Connections

- Operator → Deployment workflow: triggers
- Deployment workflow → Terraform root: runs
- Terraform root → EC2 resources: defines
- Terraform root → S3 resources: defines
- Terraform root → DynamoDB resources: defines
- Terraform root → Remote state: uses state
- Terraform root → Terraform outputs: exposes
- EC2 resources → AWS: provisions
- S3 resources → AWS: provisions
- DynamoDB resources → AWS: provisions
- inventory.json → Inventory generator: reads
- Inventory generator → Ansible hosts: writes
- Deployment workflow → Inventory generator: runs
- Deployment workflow → Ansible site play: runs
- Ansible site play → Ansible hosts: targets
- Ansible site play → Common role: applies
- Ansible site play → Firewall role: applies
- Ansible site play → SSH role: applies
- Ansible site play → Apache role: applies
- Ansible site play → Nginx role: applies
- Ansible site play → Target servers: configures
