![](/img/trans.png)
[英]failed to create ec2 instance using terraform if set security group
[英]Set functionTimeout using terraform
我需要将以下属性添加到 azure function 的 host.json 文件中。是否可以使用 terraform 或通过使用 app_setting 传递它来添加属性?
{
"functionTimeout": "00:10:00"
}
您可以使用azurerm_app_configuration在 Azure 应用服务中添加配置值。 并且azurerm_app_configuration_key用于在使用 terraform 的 Azure App Service 中添加键值对。
您可以使用以下键值对在 Azure 中添加超时值
key : AzureFunctionsJobHost__functionTimeout
Value : 00:10:00
注意:应用程序配置密钥是使用数据平面 API 提供的,这需要应用程序配置或父级 scope(例如资源组/订阅)上的应用
App Configuration Data Owner
角色。
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
]
}
参考博客添加多个键值对。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.