# Azure Resource Group Naming Convention

## Standard Naming Convention

**Format**: `{cloud}-{env}-{region}-rg-{type}-{instance}`

### Components

- **cloud**: `az` (Azure)
- **env**: `p` (prod), `d` (dev), `t` (test), `s` (staging)
- **region**: `we` (westeurope), `ne` (northeurope), etc. (see `terraform/locals.tf`)
- **rg**: Resource Group identifier
- **type**: 
  - `net` - Network resources
  - `comp` - Compute resources (AKS, VMs)
  - `stor` - Storage resources
  - `sec` - Security resources (Key Vault)
  - `mon` - Monitoring resources
  - `tfstate` - Terraform state storage
- **instance**: `001`, `002`, etc.

### Examples

- `az-p-we-rg-comp-001` - Production compute resource group in West Europe
- `az-p-we-rg-net-001` - Production network resource group in West Europe
- `az-p-we-rg-stor-001` - Production storage resource group in West Europe
- `az-p-we-rg-sec-001` - Production security resource group in West Europe
- `az-p-we-rg-mon-001` - Production monitoring resource group in West Europe

## Configuration

### Terraform

In `terraform/terraform.tfvars`, leave `resource_group_name` empty to use default naming:

```hcl
resource_group_name = ""  # Uses default: az-p-we-rg-comp-001
```

Or specify Well-Architected Framework resource groups:

```hcl
use_well_architected = true
network_resource_group_name  = "az-p-we-rg-net-001"
compute_resource_group_name  = "az-p-we-rg-comp-001"
storage_resource_group_name  = "az-p-we-rg-stor-001"
security_resource_group_name = "az-p-we-rg-sec-001"
```

### Environment Variables

Set in `.env`:

```bash
AZURE_SUBSCRIPTION_ID=fc08d829-4f14-413d-ab27-ce024425db0b
```

## Verification

Run the standardization script:

```bash
./scripts/azure/standardize-resource-groups.sh
```

## Migration

If you have existing resource groups that don't follow the convention:

1. **Option 1**: Update Terraform to use existing names (not recommended)
2. **Option 2**: Migrate resources to properly named resource groups (recommended)
3. **Option 3**: Use Well-Architected Framework with proper naming from the start
