appsettings. json позволяет нам указать иерархические настройки:
"ApplicationInsights": {
"InstrumentationKey": "..."
}
В коде они используются следующим образом - config["ApplicationInsights:InstrumentationKey"]
Однако, пытаясь предоставить ApplicationInsights:InstrumentationKey
в конфигурация terraform службы приложения:
app_settings = {
"ApplicationInsights:InstrumentationKey" = data.azurerm_application_insights.instance.instrumentation_key
}
В результате выдается следующее сообщение об ошибке:
Error: Error updating Application Settings for App Service "app505-dfpg-qa2-web-eastus2-gateway-apsvc": web.AppsClient#UpdateApplicationSettings: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="AppSetting with name 'ApplicationInsights:InstrumentationKey' is not allowed." Details=[{"Message":"AppSetting with name 'ApplicationInsights:InstrumentationKey' is not allowed."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"04072","Message":"AppSetting with name 'ApplicationInsights:InstrumentationKey' is not allowed.","MessageTemplate":"AppSetting with name '{0}' is not allowed.","Parameters":["ApplicationInsights:InstrumentationKey"]}}]
Похоже, это Azure жалуется, а не terraform.
Итак, как это можно сделать, если вообще?
РЕДАКТИРОВАТЬ 1
Пожалуйста, обратите внимание, что это только пример. С таким же успехом я могу попросить следующую иерархическую настройку:
"YabaDabaDoo": {
"YogiBear": "..."
}
Как мы предоставляем ее в конфигурации службы приложений?