![](/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.