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 =
    // Get Certificate from External KeyVault
    resource "azurerm_app_service_certificate" "cert" {
      name                = "testing-certificate-for-cic"
      resource_group_name =
      location            = azurerm_resource_group.Terraform.location 
      key_vault_secret_id =
    // Now bind the webapp to the domain. 
    resource "azurerm_app_service_custom_hostname_binding" "website_app_hostname_bind" {
      hostname            = ""
      app_service_name    =
      resource_group_name =
    // Now bind certificate to the webapp. 
    resource "azurerm_app_service_certificate_binding" "bind_certificate_to_webapp" {
      hostname_binding_id =
      ssl_state           = "SniEnabled"
      certificate_id      =