使用Function App - Terraform部署API管理



我已经通过Terraform部署了一个Azure HTTP功能应用程序,我想通过API管理管理对HTTP功能的访问。我可以看到如何通过Terraform创建API管理,但是我看不到如何将我的功能应用程序与我的API管理结合起来。通过控制台,这非常简单。我如何通过terraform做到这一点?

下面是将Azure函数作为后端添加到Azure API管理的平台代码:

resource "azurerm_api_management_backend" "example" {
name = "sample-backend"
resource_group_name = data.azurerm_resource_group.example.name
api_management_name = data.azurerm_api_management.example.name
protocol = "http"
url = "https://${azurerm_function_app.example.name}.azurewebsites.net/api/"
credentials {
header = {
"x-functions-key" = "${data.azurerm_function_app_host_keys.example.default_function_key}"
}
}
}

有关在Azure APIM中添加函数或Web API作为后端API的更多信息,请参阅Royarin博客文章。

最新更新