# rizwanislam62/static_website_with_terraform architecture

> Architecture diagram of the GitHub repository rizwanislam62/static_website_with_terraform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rizwanislam62/static_website_with_terraform
- Repository: https://github.com/rizwanislam62/static_website_with_terraform

## Overview

##### Main Components
- Terraform Configuration: This includes files like main.tf and .terraform.lock.hcl, which define the infrastructure (e.g., creation of an S3 bucket and setting its bucket policy) and manage Terraform dependencies, respectively.
- Static Website Files: index.html and style.css, which make up the content served as the website.
- AWS S3 Bucket: Not directly visible in the file tree but implied by the Terraform setup. This is where the static website content will reside.
- Terraform State Files: terraform.tfstate and terraform.tfstate.backup which keep track of the deployed infrastructure status.

##### Relationships and Interactions
- Terraform runs (using the configuration files) to create and manage the AWS S3 bucket. The main.tf script will set up the bucket and apply its policy.
- The static website files (HTML and CSS) are uploaded to the S3 bucket, forming the website content.
- The Terraform state files capture the current state of the infrastructure, allowing for future updates and management while ensuring consistency.

##### Architectural Patterns and Design Principles
- Infrastructure-as-Code (IaC): Fully automated management of the AWS resources through Terraform scripts.
- Separation of Concerns: Distinct roles for infrastructure configuration (Terraform) and website content (static files).
- Declarative Resource Management: Terraform’s configuration follows a declarative approach ensuring the defined state is achieved on AWS.

##### Relevant Technologies
- Terraform – for defining and provisioning the infrastructure.
- AWS S3 – serving as the static website hosting service.
- Standard web assets – HTML and CSS files forming the website’s frontend.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Terraform Configuration Subgraph
    subgraph "Terraform Configuration"
        TFmain["main.tf"] 
        TerraformLock[".terraform.lock.hcl"]
        TFstate["terraform.tfstate"]
        TFstateBackup["terraform.tfstate.backup"]
    end

    %% Static Website Assets Subgraph
    subgraph "Static Website Assets"
        HTML["index.html"]
        CSS["style.css"]
    end

    %% AWS S3 Bucket Node
    S3Bucket["AWS S3 Bucket"]

    %% Relationships
    TFmain -->|"configures"| S3Bucket
    HTML -->|"uploads"| S3Bucket
    CSS -->|"uploads"| S3Bucket

    %% Click Events
    click TFmain "https://github.com/rizwanislam62/static_website_with_terraform/blob/main/main.tf"
    click TerraformLock "https://github.com/rizwanislam62/static_website_with_terraform/blob/main/.terraform.lock.hcl"
    click TFstate "https://github.com/rizwanislam62/static_website_with_terraform/blob/main/terraform.tfstate"
    click TFstateBackup "https://github.com/rizwanislam62/static_website_with_terraform/blob/main/terraform.tfstate.backup"
    click HTML "https://github.com/rizwanislam62/static_website_with_terraform/blob/main/index.html"
    click CSS "https://github.com/rizwanislam62/static_website_with_terraform/blob/main/style.css"

    %% Styles
    classDef terraform fill:#F9E79F,stroke:#D4AC0D,stroke-width:2px;
    classDef website fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef aws fill:#A9DFBF,stroke:#28B463,stroke-width:2px;

    class TFmain,TerraformLock,TFstate,TFstateBackup terraform;
    class HTML,CSS website;
    class S3Bucket aws;
```
