# Multi-Cloud Provider Configuration
# Configures all cloud providers based on enabled environments

terraform {
  required_version = ">= 1.0"
  
  required_providers {
    # Azure
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~> 3.0"
    }
    
    # AWS
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
    
    # Google Cloud
    google = {
      source  = "hashicorp/google"
      version = "~> 5.0"
    }
    
    # IBM Cloud
    ibm = {
      source  = "IBM-Cloud/ibm"
      version = "~> 1.0"
    }
    
    # Oracle Cloud
    oci = {
      source  = "oracle/oci"
      version = "~> 5.0"
    }
    
    # Kubernetes (for all providers)
    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = "~> 2.0"
    }
    
    # Helm
    helm = {
      source  = "hashicorp/helm"
      version = "~> 2.0"
    }
    
    # vSphere (for on-prem HCI)
    vsphere = {
      source  = "hashicorp/vsphere"
      version = "~> 2.0"
    }
    
    # Azure Arc (for hybrid management)
    azapi = {
      source  = "Azure/azapi"
      version = "~> 1.0"
    }
  }
}

# Azure Provider Configuration
provider "azurerm" {
  features {
    resource_group {
      prevent_deletion_if_contains_resources = true
    }
    key_vault {
      purge_soft_delete_on_destroy = false
      recover_soft_deleted_key_vaults = true
    }
  }
  
  # Credentials from environment variables or Azure CLI
  # subscription_id = var.azure_subscription_id
  # tenant_id       = var.azure_tenant_id
}

# AWS Provider Configuration
provider "aws" {
  # Credentials from environment variables, AWS CLI, or IAM roles
  # access_key = var.aws_access_key_id
  # secret_key = var.aws_secret_access_key
  # region     = var.aws_default_region
}

# Google Cloud Provider Configuration
provider "google" {
  # Credentials from environment variable GOOGLE_APPLICATION_CREDENTIALS
  # project = var.gcp_project_id
  # region  = var.gcp_default_region
}

# IBM Cloud Provider Configuration
provider "ibm" {
  # Credentials from environment variables
  # ibmcloud_api_key = var.ibm_api_key
  # region           = var.ibm_default_region
}

# Oracle Cloud Provider Configuration
provider "oci" {
  # Credentials from OCI config file or environment variables
  # tenancy_ocid     = var.oci_tenancy_ocid
  # user_ocid        = var.oci_user_ocid
  # fingerprint      = var.oci_fingerprint
  # private_key_path = var.oci_private_key_path
  # region           = var.oci_default_region
}

# vSphere Provider Configuration (for on-prem HCI)
provider "vsphere" {
  # Configuration per environment
  # user           = var.vsphere_user
  # password       = var.vsphere_password
  # vsphere_server = var.vsphere_server
  # allow_unverified_ssl = true
}

# Kubernetes Provider (configured per environment)
# This will be configured dynamically based on the environment

# Helm Provider (configured per environment)
# This will be configured dynamically based on the environment

