How to import azurerm_api_management_api from Azure Container App

308 Views Asked by At

I'm having a bit of a problem parsing the differences between Azure's name for things and Terraform's name for things, but overall I'm making a good go of it. I am having some specific problems, though. I want to import the Azure Container app as an API into Azure API management service using terraform but I haven't found anything in the terraform registry(azurerm_api_management_api). Already I have gone through the import block from the terraform registry but there is no direct support in it to import Azure Container APP. I am struggling with the import code block below,

resource "azurerm_api_management_api" "example" {
  name                = "example-api"
  resource_group_name = azurerm_resource_group.example.name
  api_management_name = azurerm_api_management.example.name
  revision            = "1"
  display_name        = "Example API"
  path                = "example"
  protocols           = ["https"]

  import {
    content_format = "swagger-link-json"
    content_value  = "http://conferenceapi.azurewebsites.net/?format=json"
  }
}

Note: We have tried with the JSON file of the Azure container app but were unable to import it because we don't know the exact URL of the Azure container app which must be dynamic.

Goal: After completing the build of the Azure container app using the Azure container registry image through the Azure DevOps pipeline, we need to import that container app as an API. We can able to do it from Azure Portal GUI mode. below is the option,

Add-API-through-Import-Azure-Container-App

0

There are 0 best solutions below