# Azure Provider Configuration
# Uses environment variables or terraform.tfvars for authentication

terraform {
  required_version = ">= 1.5.0"
  
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~> 3.0"
    }
  }

  # Backend configuration (uncomment and configure for remote state)
  # backend "azurerm" {
  #   resource_group_name  = "the-order-tfstate-rg"
  #   storage_account_name = "theordertfstate"
  #   container_name       = "tfstate"
  #   key                  = "terraform.tfstate"
  # }
}

# Configure the Azure Provider
provider "azurerm" {
  features {
    resource_group {
      prevent_deletion_if_contains_resources = false
    }
    key_vault {
      purge_soft_delete_on_destroy = true
    }
    storage {
      purge_soft_delete_on_destroy = true
    }
  }

  # Use environment variables or terraform.tfvars
  # subscription_id = var.subscription_id
  # tenant_id       = var.tenant_id
  # client_id       = var.client_id
  # client_secret   = var.client_secret
}

# Data source for current subscription
data "azurerm_subscription" "current" {}

# Data source for current client config
data "azurerm_client_config" "current" {}

