如何解决使用Pulumi.Azure部署现有App Service时出错
当我尝试将现有的App Service部署到Azure时,我得到2020-10-29T22:27:58.8724283Z I1029 22:27:58.870264 4596 eventsink.go:78] eventSink::Infoerr(<{%reset%}>panic: interface conversion: interface {} is nil,not map[string]interface {} 2020-10-29T22:27:58.8728827Z <{%reset%}>) 2020-10-29T22:27:58.8735984Z I1029 22:27:58.870264 4596 eventsink.go:78] eventSink::Infoerr(<{%reset%}>goroutine 199 [running]: 2020-10-29T22:27:58.8767921Z <{%reset%}>) 2020-10-29T22:27:58.8778359Z I1029 22:27:58.870264 4596 eventsink.go:78] eventSink::Infoerr(<{%reset%}>github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/web.expandAppServiceLogs(0x47f6180,0xc0013eca00,0x4,0x47f6180,0x1)
。
此错误使我的堆栈无法部署到Azure。
var webApi = new AppService(appServiceName,new AppServiceArgs
{
Name = appServiceName,ResourceGroupName = resourceGroupName,Identity = new AppServiceIdentityArgs {Type = "SystemAssigned"},AppServicePlanId = appServicePlanId,AppSettings =
{
{"WEBSITE_RUN_FROM_PACKAGE",webApiCodeBlob},{"AzureStorage__AccountName",storageAccountName},{"AzureStorage__AccountKey",storageAccountPrimaryAccessKey},{"APPINSIGHTS_INSTRUMENTATIONKEY",appInsightsInstrumentationKey},{
"APPLICATIONINSIGHTS_CONNECTION_STRING",appInsightsConnectionString
},{"ApplicationInsightsAgent_EXTENSION_VERSION","~2"}
},ConnectionStrings =
{
new AppServiceConnectionStringArgs
{
Name = "AzureServiceBusConnectionString",Value = serviceBusConnectionString,Type = "Custom"
},new AppServiceConnectionStringArgs
{
Name = "BlobStorageConnectionString",Value = blobConnectionString,new AppServiceConnectionStringArgs
{
Name = "MongoConnectionString",Value = cosmosAccountConnectionString,Type = "Custom"
}
},SiteConfig = new AppServiceSiteConfigArgs
{
AlwaysOn = true,Cors = new AppServiceSiteConfigCorsArgs
{
AllowedOrigins = allowedOrigins
}
},Tags = new InputMap<string>()
{
{"team",Team},{"product",Product},{"productId",ProductId},{"environment",environment},{"service",ServiceName}
},});
如果App Service不存在,它将在第一次运行。仅当它部署现有的App Service时,此操作才会失败。只有在App Service中没有定义“日志”部分时,才会发生这种情况。
我正在使用Pulumi 3.28.0
解决方法
我找到了一种解决方法,它基于此https://github.com/pulumi/pulumi-azure/issues/383#issuecomment-549192628
在App Service中没有配置“日志”部分时,它试图将您的C#堆栈转换为Pulumi的内部表示,这是一个无法映射的nil值,请打开链接以查看有关的更准确的详细信息根本原因。
这就是我能够使其工作的方式。
将“日志”部分添加到您的AppService
Logs = new AppServiceLogsArgs
{
ApplicationLogs = new AppServiceLogsApplicationLogsArgs
{
AzureBlobStorage = new AppServiceLogsApplicationLogsAzureBlobStorageArgs
{
Level = "Information",RetentionInDays = 1,SasUrl = $"${storageAccount.PrimaryBlobEndpoint}{blobSas}"
}
},HttpLogs = new AppServiceLogsHttpLogsArgs
{
FileSystem = new AppServiceLogsHttpLogsFileSystemArgs
{
RetentionInDays = 1,RetentionInMb = 100
}
}
},
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。