英文:
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文件,如下所示。
我如何将其引用为我的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.
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")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论