Search code examples
terraformswaggerazure-api-managementterraform-provider-azurecontent-values

Are there alternative azurerm_api_management_api content_value paths?


I am trying to create a new Azure API using the Terraform module azurerm_api_management_api. An example of the snippet of code I'm using is as 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"
  }
}

I do however have one major challenge. The content_value for my swagger file needs to point to a *.json file that is in my 'test-input' folder, as depicted below.

enter image description here

How can I reference it as my content_value? All the terraform documentation I've come across appear to indicate it can only be in a URL format?


Solution

  • Well, managed to resolve my own issue. It turns out that changing the content_format value was all that was required. I therefore ended up with the below code block which worked out perfectly.

    content_format = "openapi+json"
    content_value  = file("../test-input/conf_api_swagger.json")