是否存在替代的azurerm_api_management_api content_value路径?

huangapple go评论80阅读模式
英文:

Are there alternative azurerm_api_management_api content_value paths?

问题

我正在尝试使用Terraform模块azurerm_api_management_api创建一个新的Azure API。我正在使用的代码片段示例如下。

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"
  }
}

然而,我有一个主要的挑战。我的Swagger文件的content_value需要指向我的'test-input'文件夹中的*.json文件,如下所示。

是否存在替代的azurerm_api_management_api content_value路径?

我如何将其引用为我的content_value?我遇到的所有Terraform文档似乎都指示它只能以URL格式存在?

英文:

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.

是否存在替代的azurerm_api_management_api content_value路径?

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?

答案1

得分: 0

成功解决了我的问题。原来只需要更改content_format的值就可以了。因此,最终我得到了下面完美运行的代码块。

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

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")

huangapple
  • 本文由 发表于 2023年7月24日 16:08:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76752505.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定