> ## Documentation Index
> Fetch the complete documentation index at: https://docs.soundchecklive.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Environments

> Environment-specific infrastructure details

Soundcheck infrastructure is deployed across multiple environments for development, testing, and production.

## Environment summary

| Environment | Branch | Purpose | Naming Prefix |
| - | - | - | - |
| Sandbox | N/A | Manual testing | `sbx-cus-*` |
| Dev | `dev` | Development integration | `dev01-cus-*` |
| QA | `qa` | Quality assurance | `qa01-cus-*` |
| Prod | `main` | Production | `prod-cus-*` |

***

## Development environment

### Resources

| Resource | Name |
| - | - |
| Key Vault | `dev01-cus-core-kv` |
| App Service | Removed (API runs on GCP `api-events`) |
| Database | `dev01-cus-db` |
| API URL | `https://dev.api.soundchecklive.io` |

### Configuration

```hcl theme={null}
env         = "dev01"
region      = "centralus"
region_code = "cus"
```

### Deployment

Merging to `dev` branch triggers automatic deployment.

***

## QA environment

### Resources

| Resource | Name |
| - | - |
| Key Vault | `qa01-cus-core-kv` |
| App Service | Removed (API runs on GCP `api-events`) |
| Database | `qa01-cus-db` |
| VPN Range | `172.16.202.0/24` |

### Configuration

```hcl theme={null}
env         = "qa01"
region      = "centralus"
region_code = "cus"
```

### Deployment

Merging `dev` → `qa` triggers automatic deployment.

***

## Production environment

### Resources

| Resource | Name |
| - | - |
| Key Vault | `prod-cus-core-kv` |
| App Service | `prod-cus-api-app` |
| Database | `prod-cus-db` |
| VPN Range | `172.16.203.0/24` |

### Configuration

```hcl theme={null}
env         = "prod"
region      = "centralus"
region_code = "cus"
```

### Scaling

* **Autoscaling**: Enabled
* **Min instances**: 2
* **Max instances**: 5

### Deployment

Merging `qa` → `main` requires approval, then triggers deployment.

***

## Sandbox environment

Sandbox is for manual testing of infrastructure changes.

### Setup

```bash theme={null}
# Login to Azure
az login
az account set --subscription "Microsoft Azure Sponsorship"

# Create sandbox tfvars
cd infra/environments/dev
cp dev.tfvars.example sandbox.tfvars

# Edit sandbox.tfvars with unique prefix
```

### Deploy

```bash theme={null}
terraform init
terraform apply -var-file="sandbox.tfvars"
```

### Cleanup

> [!WARNING]
>
> Always destroy sandbox resources when done to avoid charges:
>
> ```bash theme={null}
> terraform destroy -var-file="sandbox.tfvars"
> ```

***

## Environment variables

Each environment has its own tfvars file:

| File | Purpose | Committed |
| - | - | - |
| `dev.tfvars.example` | Template | ✅ Yes |
| `dev.tfvars` | Actual values (generated) | ❌ No |
| `qa.tfvars` | QA values (generated) | ❌ No |
| `prod.tfvars` | Prod values (generated) | ❌ No |
| `sandbox.tfvars` | Manual testing | ❌ No |

### Generating tfvars

The `generate-tfvars.sh` script pulls secrets from Key Vault:

```bash theme={null}
./generate-tfvars.sh
```

***

## Promotion workflow

```
Feature Branch
     │
     ▼
   Dev ────────────────► QA ────────────────► Prod
     │                     │                     │
     │ Merge triggers      │ Merge triggers      │ Requires approval
     │ apply to Dev        │ apply to QA         │ Applies to Prod
     ▼                     ▼                     ▼
 dev01-cus-*           qa01-cus-*           prod-cus-*
```

***

## Access control

### VPN access required

These resources require VPN in Dev/QA:

* Database direct access
* Key Vault management
* Log Analytics dashboards
* Internal APIs

### Public access

These are publicly accessible:

* App Service endpoints (production API App Service only)
* Static Web App (frontend)
* API health checks

***

## Naming convention

Resources follow this naming pattern:

```
{env}-{region_code}-{resource_type}
```

Examples:

* `prod-cus-api-app` - Production API App Service (dev/qa no longer provision this)
* `qa01-cus-core-kv` - QA Key Vault
* `prod-cus-db` - Production Database


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.