How can i read a certificate from Azure Keyvault and add it to a web app in azure with Terraform

I have a certificate in a keyvault and need to add that certificate to a web app. How can I do this using terraform in Azure?

The certificate is stored in the Keyvault under certificates NOT secrets

You can try with this:

    // First Read the External Key Vault
    data "azurerm_key_vault" "production_keyvault" {
      name                = "secrets-testingprodjc"
      resource_group_name = "Testing_Prod_KeyVault_JC"
    }
    
    // Now Read the Certificate
    data "azurerm_key_vault_certificate" "prod_certificate" {
      name         = "testing-certificate-for-cic"
      key_vault_id = data.azurerm_key_vault.production_keyvault.id
    }
    
    // Get Certificate from External KeyVault
    resource "azurerm_app_service_certificate" "cert" {
      name                = "testing-certificate-for-cic"
      resource_group_name = azurerm_resource_group.Terraform.name
      location            = azurerm_resource_group.Terraform.location 
      key_vault_secret_id = data.azurerm_key_vault.production_keyvault.id
    }
    
    // Now bind the webapp to the domain. 
    resource "azurerm_app_service_custom_hostname_binding" "website_app_hostname_bind" {
      hostname            = "portal-staging-westeurope.jasoncontenttestingdomain.com"
      app_service_name    = azurerm_app_service.website_app.name
      resource_group_name = azurerm_resource_group.Terraform.name
    }
    
    // Now bind certificate to the webapp. 
    resource "azurerm_app_service_certificate_binding" "bind_certificate_to_webapp" {
      hostname_binding_id = azurerm_app_service_custom_hostname_binding.website_app_hostname_bind.id
      ssl_state           = "SniEnabled"
      certificate_id      = azurerm_app_service_certificate.cert.id
    }