gpt4 book ai didi

azure - 使用 terraform 设置 functionTimeout

转载 作者:行者123 更新时间:2023-12-03 01:19:39 26 4
gpt4 key购买 nike

我需要将以下属性添加到我的 host.json 文件中以实现 azure 功能。是否可以使用 terraform 添加属性或使用 app_setting 传递属性?

{
"functionTimeout": "00:10:00"
}

最佳答案

您可以使用azurerm_app_configuration在 Azure 应用服务中添加配置值。和azurerm_app_configuration_key用于使用 terraform 在 Azure 应用服务中添加键值对。

您可以使用下面的键值对在 Azure 中添加超时值

key : AzureFunctionsJobHost__functionTimeout 
Value : 00:10:00

示例

Note:App Configuration Keys are provisioned using a Data Plane API which requires the role App Configuration Data Owner on either the App Configuration or a parent scope (such as the Resource Group/Subscription).

resource "azurerm_resource_group" "rg" {
name = "example-resources"
location = "example-location"
}

resource "azurerm_app_configuration" "appconf" {
name = "appConf1"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
}

## Adding the App Configuration Data Owner role
data "azurerm_client_config" "current" {}

resource "azurerm_role_assignment" "appconf_dataowner" {
scope = azurerm_app_configuration.appconf.id
role_definition_name = "App Configuration Data Owner"
principal_id = data.azurerm_client_config.current.object_id
}


## Adding the App Settings config values
resource "azurerm_app_configuration_key" "test" {
configuration_store_id = azurerm_app_configuration.appconf.id
key = "<Your host.json timeout key "AzureFunctionsJobHost__functionTimeout">"
label = "somelabel"
value = "<Your timeout value "00:10:00">"

depends_on = [
azurerm_role_assignment.appconf_dataowner
]
}

引用blog用于添加多个键值对。

关于azure - 使用 terraform 设置 functionTimeout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71935339/

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