Skip to content

Architecture

This repository manages shared Azure resources for Jersal projects and hosts the personal site built with Vite. Terraform provisions infrastructure in two resource groups with separate state backends.

Subscription

  • sub-jersal-projects

Resource groups

Resource group Region Purpose
rg-jersal-projects-shared swedencentral Shared services (PostgreSQL, state backend)
rg-jersal-site-sc swedencentral Site infrastructure (SWA, state backend)

Infrastructure diagram

graph TB
    subgraph "rg-jersal-projects-shared (swedencentral)"
        PG["PostgreSQL Flexible Server<br/>Standard_B1ms"]
        ST1["Storage Account<br/>stjersalprojcore<br/>(tfstate-shared)"]
        RBAC1["RBAC Assignments"]
    end

    subgraph "rg-jersal-site-sc (swedencentral)"
        SWA["Static Web App<br/>swa-jersal-site-sc<br/>(westeurope)"]
        ST2["Storage Account<br/>stjersalprojcoresite<br/>(tfstate-site)"]
        RBAC2["RBAC Assignments"]
    end

    GH["GitHub Actions<br/>(OIDC Auth)"] --> PG
    GH --> SWA
    GH --> ST1
    GH --> ST2

    PROJECTS["Project Repos"] --> |consume| PG

Terraform layout

Path Purpose
terraform/backend/ Bootstraps storage accounts and containers for state
terraform/modules/ Reusable building blocks (postgres-flex, rbac, resource-group, swa)
terraform/envs/shared/ Provisions shared services (PostgreSQL, RBAC)
terraform/envs/site/ Provisions the Static Web App (SWA)

Shared resources

  • PostgreSQL Flexible Server for project databases
    • Default SKU: Standard_B1ms (Terraform adds B_ prefix for Azure)
    • Version: 15
    • Storage: 32 GB
    • Backup retention: 7 days
    • Public network access enabled (firewall-controlled)

Site resources

  • Azure Static Web App for jersal.net
    • SWA region: westeurope (closest available to swedencentral)
    • SKU: Free tier

Conventions

Convention Value
Region code sc (swedencentral)
Naming prefix jersal-projects
Environment prod
Terraform version >= 1.6.6
Azure provider ~> 4.60