# Deployment Configuration Top-level orchestration files combining workspace definitions, environments, and configurations to create **actual infrastructure instances**. A deployment represents a concrete, deployable unit. ## Conceptual Model | Layer | Purpose | Description | | --------------- | ---------------- | ---------------------------------------------------- | | **Workspace** | WHAT to build | Infrastructure blueprint | | **Environment** | HOW to customize | Environment-specific overrides | | **Deployment** | ACTUAL INSTANCE | Combines workspace + environment(s) + configurations | **Deployment = Workspace + Environment(s) + Configuration(s) + Deployment Overrides** ## Schema ```yaml apiVersion: strata.huybrechts.xyz/v1 kind: deployment meta: name: # Required: ^[a-z][a-z0-9_]*$ annotations: description: labels: version: "" spec: properties: {} # Deployment metadata custom: {} # Organizational metadata workspace: # Required: infrastructure blueprint name: description: source: type: # local, gitops, image, script repository: reference: source_path: environments: [] # Environment configs (applied in order) - name: description: source: {} configurations: [] # Additional config layers (optional) - name: description: source: {} features: {} # Deployment-specific feature flags variables: [] # Deployment variables (highest precedence) secrets: [] # Deployment secrets (highest precedence) ``` ## Properties & Custom **Properties** - Deployment identification: ```yaml properties: tenant: acme-corp project: platform environment: production ``` **Custom** - Organizational metadata: ```yaml custom: owner: "Platform Team" costcenter: "PROD-001" billing_code: "BC-123" ``` ## Workspace Reference Required reference to infrastructure blueprint: ```yaml workspace: name: platform_workspace source: type: local # local, gitops, image, script repository: / reference: / source_path: config/workspaces/platform.yaml ``` ## Environments Environment configs applied in order (later overrides earlier): ```yaml environments: - name: production source: type: local repository: / reference: / source_path: config/environments/production.yaml - name: regional_us_east # Overrides production source: type: local repository: / reference: / source_path: config/environments/us-east.yaml ``` **Multiple environments enable layered configuration composition.** ## Configurations Additional configuration layers (optional): ```yaml configurations: - name: tenant_config source: type: local repository: / reference: / source_path: config/configurations/tenant-a.yaml ``` _Use for: application-specific settings, tenant configs, compliance requirements_ ## Features, Variables & Secrets **Features** - Deployment-specific flags (highest precedence): ```yaml features: premium_features: true advanced_analytics: true ``` **Variables** - Deployment variables (highest precedence): ```yaml variables: - key: DEPLOYMENT_ID source: constant value: prod-tenant-001 ``` **Secrets** - Deployment secrets (highest precedence): ```yaml secrets: - key: TENANT_API_KEY source: bitwarden value: tenant-api-key-id ``` ## Configuration Merge Order Precedence from lowest to highest: 1. Workspace defaults (base) 2. Environment 1 3. Environment 2…N (in order) 4. Configuration 1 5. Configuration 2…N (in order) 6. **Deployment overrides** (highest precedence) **Per-section merge rules when multiple environment files are listed:** | Section | Strategy | | ----------------------------------------------- | ------------------------------------------------------------------------ | | `variables` / `secrets` | Last-wins by `key` | | `features` | Last-wins by `key` (each flag merged independently) | | `properties` / `custom` | Shallow `dict.update()` — earlier keys preserved if absent in later file | | `lifecycle` / `audit` | Last-wins (wholesale) | | `overrides.resources` / `providers` / `remotes` | Last-wins by name | | `overrides.modules` | Last-wins by `(module, resource, namespace, slot_type)` | | `overrides.includes` / `output_files` | Additive (deduplicated) | To trace which file contributed each resolved value: ```bash strata values list -f deploy/deploy-prd.yaml --trace ``` See [Environment Composition](../guides/environment-composition.md) for patterns and full examples. ## Examples **Simple:** ```yaml meta: name: platform_prod labels: version: "1.0.0" spec: properties: tenant: acme-corp environment: production workspace: name: platform_workspace source: type: local repository: / reference: / source_path: config/workspaces/platform.yaml environments: - name: production_env source: type: local repository: / reference: / source_path: config/environments/production.yaml ``` **Multi-Layer:** ```yaml meta: name: tenant_deployment labels: version: "2.0.0" spec: properties: tenant: tenant-a project: saas-platform custom: tenant_id: "CUST-001" tier: "premium" sla: "99.99%" workspace: name: saas_workspace source: type: gitops repository: https://github.com/org/workspaces.git reference: v1.5.0 source_path: workspaces/saas-platform.yaml environments: - name: base_production source: type: local repository: / reference: / source_path: config/environments/production.yaml - name: regional_us_east source: type: local repository: / reference: / source_path: config/environments/us-east.yaml configurations: - name: tenant_a_config source: type: local repository: / reference: / source_path: config/configurations/tenant-a.yaml features: premium_features: true advanced_analytics: true variables: - key: DEPLOYMENT_ID source: constant value: prod-tenant-a-001 secrets: - key: TENANT_API_KEY source: bitwarden value: tenant-a-api-key-id ``` **GitOps:** ```yaml meta: name: gitops_deployment spec: workspace: name: infrastructure source: type: gitops repository: https://github.com/org/infrastructure.git reference: v2.3.0 source_path: workspaces/main.yaml environments: - name: production source: type: gitops repository: https://github.com/org/environments.git reference: main source_path: production/us-east-1.yaml ``` ## Use Cases **Multi-tenant SaaS:** ```text workspace: saas-platform.yaml (same for all) deployments/ ├── tenant-a-deployment.yaml # Premium tier ├── tenant-b-deployment.yaml # Standard tier └── tenant-c-deployment.yaml # Enterprise tier ``` **Multi-region:** ```text workspace: global-platform.yaml (same) deployments/ ├── us-east-deployment.yaml # US East region ├── eu-west-deployment.yaml # EU West region └── ap-south-deployment.yaml # Asia Pacific ``` **Blue-green:** ```yaml # Blue (current) blue-deployment.yaml: variables: - key: DEPLOYMENT_COLOR value: blue # Green (new version) green-deployment.yaml: variables: - key: DEPLOYMENT_COLOR value: green - key: APP_VERSION value: v2.0.0 ``` **Staged rollout:** ```yaml # Canary (1%) canary-deployment.yaml: environments: [production.yaml, canary.yaml] features: traffic_percentage: 1 # Beta (20%) beta-deployment.yaml: environments: [production.yaml, beta.yaml] features: traffic_percentage: 20 # Full (100%) production-deployment.yaml: environments: [production.yaml] features: traffic_percentage: 100 ``` ## Deployment Workflow 1. Load deployment → Parse config 2. Resolve sources → Fetch workspace/environment/config files 3. Merge configurations → Apply merge order 4. Validate → Validate merged config 5. Generate artifacts → Create Terraform/manifests/Helm values 6. Execute lifecycle → Run workspace phases 7. Provision infrastructure → Deploy infrastructure 8. Deploy applications → Deploy namespaces/modules 9. Verify → Run health checks 10. Register → Register deployment instance ## Stages Deployment stages are the unit of execution. Each stage maps to exactly one deployer run (one IaC tool, one lifecycle context). Stages execute sequentially in declaration order. ```yaml stages: - name: network # Unique label within the deployment provisioner: my_tf # Name of a provisioner in workspace.spec.provisioners # topology: k8s_aks # Alternative to provisioner — resolved via topology map # scope: infra # Optional label for --scope CLI filtering (see deploy run --scope) secrets: # Allowlist of secrets this stage may access (default-deny) - hetzner_api_token steps: # Which steps to run (default: all supported steps) - setup - check - plan - apply timeouts: # Per-step overrides (seconds) setup: 120 plan: 600 apply: 3600 ``` ### `provisioner` vs `topology` Exactly one of `provisioner` or `topology` must be set (or omitted when the workspace has a single provisioner and the deployer can infer it). | Field | Behaviour | | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `provisioner` | Matches a provisioner entry in `workspace.spec.provisioners` by **name**. Direct, explicit. | | `topology` | Looks up a topology entry in `workspace.spec.topology` by name, reads its `provisioner` type, then finds the matching provisioner. Use when stages should be expressed in logical terms (e.g. "kubernetes") rather than tooling names (e.g. "my_aks_tf"). | If both are set, `provisioner` takes precedence. If neither is set and the workspace has a single provisioner, that one is used as a fallback. ### `scope` — stage filtering `scope` is an optional free-form label. Assign the same label to stages that belong to the same logical group, then use `--scope