gpt4 book ai didi

azure - 使用 terraform 到 Azure APIM 的多个版本集和每个版本集下的多个 API,目前我收到正文中提到的错误

转载 作者:行者123 更新时间:2023-12-03 03:33:25 25 4
gpt4 key购买 nike

我已经使用了 API 资源中设置的 dependent_on 版本,但仍然收到以下错误

Error - Future#WaitForCompletion: the number of retries has been exceeded: StatusCode=400 -- Original Error: Code="ValidationError" Message="One or more fields contain incorrect values:" Details=[{"code":"ValidationError","message":"Can't set VersionName when ApiVersionSetId is not set.","target":"ApiVersion

最佳答案

我尝试使用 terraform 创建 APIM 并将版本设置为该 APIM。每当您尝试创建 APIM 的多个版本时,azure 都会为该特定 API 创建一个版本集。

  • 您需要将该版本集 ID 引用至 APIM。

参见:azurerm_api_management_api_version_set | Resources | hashicorp/azurerm | Terraform Registry

  resource "azurerm_api_management_api_version_set" "example" {
name = "kaexample-apimapi"
resource_group_name = data.azurerm_resource_group.example.name
api_management_name = azurerm_api_management.example.name
display_name = "ExampleAPIVersionSet"
versioning_scheme = "Segment"
}


resource "azurerm_api_management" "example" {
name = "kaexample-apim"
location = data.azurerm_resource_group.example.location
resource_group_name = data.azurerm_resource_group.example.name
publisher_name = "My Company"
publisher_email = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f088888888b0979d91999cde939f9d" rel="noreferrer noopener nofollow">[email protected]</a>"

sku_name = "Developer_1"
}

resource "azurerm_api_management_api" "example" {
name = "kaexample-api"
resource_group_name = data.azurerm_resource_group.example.name
api_management_name = azurerm_api_management.example.name
revision = "1"
display_name = "My Example API"
path = "example"
protocols = ["https"]
version = "v1"
version_set_id = azurerm_api_management_api_version_set.example.id

import {
content_format = "<>"
content_value = "http://xxxxapi.azurewebsites.net/?format=json"
}
}

enter image description here

如果版本集未更新,对于具有多个版本的 api,使用 terraform import 导入它
azurerm_api_management_api_version_set.example/subscriptions/xxxx/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/apiVersionSets/set1

引用: Tutorial - Publish versions of your API using Azure API Management | Microsoft Learn

关于azure - 使用 terraform 到 Azure APIM 的多个版本集和每个版本集下的多个 API,目前我收到正文中提到的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74184978/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com