Aller au contenu

PD-1 — Plan d'implémentation


📚 Navigation User Story | Document | | | ---------- | -- | | 📋 [Spécification](PD-1-specification.md) | | | 🛠️ **Plan d'implémentation** | *(ce document)* | | ✅ [Critères d'acceptation](PD-1-acceptability.md) | | | 📝 Retour d'expérience | *(à venir)* | [← Retour à infrastructure-souveraine](../PD-193-epic.md) · [↑ Index User Story](index.md)

Objectif

Provisionner l'infrastructure cloud souveraine via Terraform sur OVH Cloud (région GRA11, Gravelines, France).

Choix techniques retenus

  • Provider : OVH Cloud Public Cloud
  • IaC : Terraform 1.5+
  • Région : GRA11 (Gravelines, France)
  • Backend : S3 OVH pour state
  • Secrets : HashiCorp Vault

Architecture ciblée

terraform/
├── main.tf                 # Configuration principale
├── variables.tf            # Variables d'entrée
├── outputs.tf              # Sorties
├── providers.tf            # Providers OVH/AWS
├── security_groups.tf      # Security groups
├── modules/
│   ├── vpc_hsm/            # VPC pour HSM (AWS)
│   ├── ovh_dns/            # DNS OVH
│   └── ...
└── environments/
    ├── dev/
    ├── staging/
    └── prod/

Découpage technique

Phase 1 : Configuration Terraform

  1. Configurer provider OVH :
terraform {
  required_providers {
    ovh = {
      source  = "ovh/ovh"
      version = "~> 0.40"
    }
  }
  backend "s3" {
    bucket   = "probatiovault-terraform-state"
    key      = "infra/terraform.tfstate"
    region   = "gra"
    endpoint = "s3.gra.cloud.ovh.net"
  }
}
  1. Configurer variables sensibles via Vault

Phase 2 : Réseau OVH

  1. Créer projet Public Cloud
  2. Configurer vRack si nécessaire
  3. Définir security groups :
  4. Backend : 443 (HTTPS), 5432 (PostgreSQL internal)
  5. HSM : VPN uniquement

Phase 3 : DNS OVH

  1. Créer module ovh_dns :
  2. Zone probatiovault.com
  3. Records A/AAAA pour API
  4. Records pour environnements (dev, staging, prod)

Phase 4 : Intégration AWS (HSM)

  1. Configurer provider AWS (eu-west-3)
  2. Créer VPC dédié HSM
  3. Configurer VPN Site-to-Site OVH ↔ AWS

Phase 5 : Scripts helper

  1. scripts/terraform-with-vault.sh :
  2. Récupérer credentials depuis Vault
  3. Exporter comme env vars
  4. Exécuter terraform

Phase 6 : Environnements

  1. Créer structure par environnement :
  2. environments/dev/main.tf
  3. environments/staging/main.tf
  4. environments/prod/main.tf

  5. Utiliser workspaces ou dossiers séparés

Phase 7 : CI/CD

  1. Pipeline GitLab :
  2. plan : terraform plan
  3. apply : terraform apply (manuel)
  4. destroy : terraform destroy (protégé)

Points de vigilance

  • Credentials : Jamais en dur, toujours Vault
  • State : Stockage distant obligatoire
  • Locks : DynamoDB pour locking state
  • Drift : Détecter changements manuels

Hors périmètre

  • Provisioning PostgreSQL (→ PD-2)
  • Buckets S3 (→ PD-4)
  • CloudHSM (→ module dédié)