Gabriel Radureau 00a838799b feat(multi-env): Phase D1 — provision erp-sandbox Postgres DB + role
Activates the sandbox environment for the ERP on the Postgres side
(ADR-0002 Phase D). `erp` gains `envs = ["prod", "sandbox"]`, so the
elision flatten now materialises a second instance `erp-sandbox`:
  - database `erp-sandbox`
  - owner role `erp_sandbox_role` (snake-case per the convention)
  - pgbouncer user_lookup function + grants for the new DB

The prod `erp` instance is unchanged (db `erp`, role `erp_role`) — the
apply is purely additive (~6 resources for erp-sandbox, 0 changed,
0 destroyed on everything else). Verified the flatten output with a
standalone tofu apply before pushing.

This is D1 of the Phase D activation. D2 (tools Vault policies),
D3 (erp iac creds + KV), D4 (ArgoCD Application) follow in order.

Refs ADR-0002 (factory#15), Phase B (factory#16).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-28 17:05:50 +02:00

Arcodange Factory

%%{init: { 'logLevel': 'debug', 'theme': 'base', 'rough':true } }%%
flowchart

    prepare_hd>HD setup]
    prepare_pg>PG Setup]
    prepare_gitea>Gitea Setup]

    origin_repo[[original repositories]]
    github_repo_m[[gitea mirrors]]
    gitlab_repo_m[[gitea mirrors]]

    origin_repo -. mirrored .->gitlab_repo_m
    origin_repo -. mirrored .->github_repo_m

    tofu.state -. manages providers/go-gitea .- origin_repo
    tofu.state -. manages providers/gitlabhq/gitlab .- gitlab_repo_m
    tofu.state -. manages providers/integrations/github .- github_repo_m

    subgraph Home
        subgraph pi1
            runner[/gitea runners\]
            subgraph small HD
                backup_data
            end
        end
        subgraph pi2
            PG[(Postgres)]
            subgraph Gitea
                origin_repo
            end
            subgraph HD
                PG_data
                Gitea_data
            end
        end
        subgraph pi3
            subgraph ai
                ollama
            end
        end
        subgraph "master (macbook pro)"
            ansible{{ansible control-node}}
            tofu{{opentofu control-node}}
            subgraph ansible_scripts
                direction TB
                prepare_hd --> prepare_pg --> prepare_gitea
            end
        end
    end
    subgraph Internet
        subgraph Gitlab
            subgraph Group Arcodange
                gitlab_repo_m
            end
        end
        subgraph Github
            subgraph Organization Arcodange
                github_repo_m
            end
        end
        subgraph GCP
            subgraph project arcodange
                subgraph gs://arcodange-tf
                    tofu.state
                end
            end
        end
    end

    tofu == plan/apply ==> tofu.state
    ansible == deploy ==> HD
    ansible == deploy ==> PG
    ansible == deploy ==> Gitea
    ansible --- ansible_scripts

classDef done fill:gold,stroke:indigo,stroke-width:4px,color:blue;
class prepare_hd,nodeId2 done;

Documentation

🏹💻🪽

Description
No description provided
Readme 1.4 MiB
Languages
HCL 39%
Mermaid 34.8%
Jinja 8.3%
JavaScript 8.3%
Python 4.9%
Other 4.7%