# Terraform configuration for The Order infrastructure
# Azure provider configuration - No US Commercial or Government regions
# Version constraints are in versions.tf

# Configure the Azure Provider
provider "azurerm" {
  features {
    resource_group {
      prevent_deletion_if_contains_resources = false
    }
    key_vault {
      purge_soft_delete_on_destroy = true
    }
  }
  
  # Default location - West Europe (no US regions)
  # This can be overridden per resource if needed
  location = var.azure_region
}

# Variables
variable "azure_region" {
  description = "Azure region (default: westeurope, no US regions allowed)"
  type        = string
  default     = "westeurope"
  
  validation {
    condition     = !can(regex("^us", var.azure_region))
    error_message = "US Commercial and Government regions are not allowed. Use European or other non-US regions."
  }
}

variable "environment" {
  description = "Environment name (dev, stage, prod)"
  type        = string
  default     = "dev"
  
  validation {
    condition     = contains(["dev", "stage", "prod"], var.environment)
    error_message = "Environment must be dev, stage, or prod."
  }
}

# Outputs
output "environment" {
  description = "Environment name"
  value       = var.environment
}

output "azure_region" {
  description = "Azure region being used"
  value       = var.azure_region
}

