# Terraform Backend Configuration
# Configured to use naming convention: {cloud}-{env}-{region}-{resource}-{instance}
# Storage account will be created by Terraform if it doesn't exist

terraform {
  backend "azurerm" {
    # Using environment variables (recommended for security)
    # Set these in .env or export before running terraform init:
    #   ARM_STORAGE_ACCOUNT_NAME - Storage account name (e.g., azpwetfstate001)
    #   ARM_CONTAINER_NAME - Container name (typically "tfstate")
    #   ARM_RESOURCE_GROUP_NAME - Resource group containing storage account
    #   ARM_ACCESS_KEY - Storage account access key (or use Managed Identity)
    #
    # Alternative: Uncomment and configure below (less secure)
    # resource_group_name  = "az-p-we-rg-tfstate-001"
    # storage_account_name = "azpwetfstate001"  # Must be globally unique, lowercase, alphanumeric
    # container_name       = "tfstate"
    # key                  = "defi-oracle-mainnet.terraform.tfstate"
    
    # Note: If using Well-Architected Framework, storage account should be in storage resource group
    # For legacy deployment, it can be in the compute resource group
  }
}

# Note: Storage account name must be:
# - 3-24 characters
# - Lowercase letters and numbers only
# - Globally unique across all Azure subscriptions

