hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.64k forks source link

azurerm_bot_channel_directline deployment fails with autorest/azure error #17869

Open nikhilkandur opened 2 years ago

nikhilkandur commented 2 years ago

Is there an existing issue for this?

Community Note

Terraform Version

0.13.7

AzureRM Provider Version

3.16.0

Affected Resource(s)/Data Source(s)

azurerm_bot_channel_directline.directline_bot_channel_registration

Terraform Configuration Files

resource "azurerm_bot_channel_directline" "directline_bot_channel_registration" {
  bot_name            = azurerm_bot_channels_registration.bot_channels_registration.name
  location            = azurerm_bot_channels_registration.bot_channels_registration.location
  resource_group_name = data.azurerm_resource_group.rg_microaccount.name

  site {
    name    = "Default Site"
    enabled = true
  }
}

Debug Output/Panic Output

azurerm_bot_channel_directline.directline_bot_channel_registration: Still modifying... [id=/subscriptions/3...a-...nagerBot/channels/DirectLineChannel, 6m50s elapsed]
azurerm_bot_channel_directline.directline_bot_channel_registration: Still modifying... [id=/subscriptions/3...-...nagerBot/channels/DirectLineChannel, 7m0s elapsed]
azurerm_bot_channel_directline.directline_bot_channel_registration: Still modifying... [id=/subscriptions/3...a-...nagerBot/channels/DirectLineChannel, 7m10s elapsed]
azurerm_bot_channel_directline.directline_bot_channel_registration: Still modifying... [id=/subscriptions/33...-...nagerBot/channels/DirectLineChannel, 7m20s elapsed]
azurerm_bot_channel_directline.directline_bot_channel_registration: Still modifying... [id=/subscriptions/3...-...nagerBot/channels/DirectLineChannel, 7m30s elapsed]

Error: updating Directline Channel for Bot "...nagerBot" (Resource Group "GROUP_NAME"): botservice.ChannelsClient#Update: Failure responding to request: StatusCode=500 -- Original Error: autorest/azure: Service returned an error. Status=500 Code="UnknownError" Message="An unexpected error occurred. Exception: 'System.NullReferenceException: Object reference not set to an instance of an object.\r\n   at Intercom.ResourceProvider.ServiceModel.DirectLineChannelResource.<>c__DisplayClass1_0.<PatchFrom>b__1(JToken s) in C:\\__w\\1\\s\\Intercom.ResourceProvider\\ServiceModel\\Channels\\DirectLineChannelResource.cs:line 53\r\n   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)\r\n   at Intercom.ResourceProvider.ServiceModel.DirectLineChannelResource.PatchFrom(DirectLineChannelResource updatedChannelResource, JToken properties) in C:\\__w\\1\\s\\Intercom.ResourceProvider\\ServiceModel\\Channels\\DirectLineChannelResource.cs:line 52\r\n   at Intercom.ResourceProvider.Channels.BaseTypedArmChannelManager`3.<UpdateChannelAsync>d__8.MoveNext() in C:\\__w\\1\\s\\Intercom.ResourceProvider\\Channels\\ArmChannelManager.cs:line 386\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\r\n   at Intercom.ResourceProvider.DataProviders.ChannelResourceDataProvider.<ReplaceResourceAsync>d__12.MoveNext() in C:\\__w\\1\\s\\Intercom.ResourceProvider\\DataProviders\\ChannelResourceDataProvider.cs:line 213'."

Expected Behaviour

With the same script the deployment worked for almost like 100 deployments. It started to croak this week. The directline channel registration takes around ~8 minutes before it throws high level exception and deployment gets aborted. I'm not even sure why does directline channel registration gets modified/updated in every deployment even though it is not necessary.

Actual Behaviour

Deployment breaks by throwing the exception mentioned in the Debug Output/Panic Output section

Steps to Reproduce

terraform apply

Important Factoids

No response

References

A partially related error - https://github.com/hashicorp/terraform-provider-azurerm/issues/8200#issuecomment-679435094

nikhilkandur commented 2 years ago

Any updates ? Same thing happens while creation as well. It just times out.

bfsmith commented 1 year ago

I have not had an issue using TF v1.5.0 and

 azurerm = {
      source  = "hashicorp/azurerm"
      version = "~> 3.53.0"
    }