Open avinode-amagdy opened 6 months ago
Thanks @avinode-amagdy for raising this issue, are you able to do the redeploy using azure cli (https://learn.microsoft.com/en-us/cli/azure/webapp/deployment/source?view=azure-cli-latest) after you updated the configuration file?
@xiaxyi I tried to re-deploy the app using the command you provided a link to, and it works when after the first deployment but after terraform fails I get the following error in command line (using the command you referred to):
There was a conflict. Conflict with existing ScmType: ExternalGit
I really cannot get my hands on the pattern when it fails, the failure seems very random specially that now it's not failing after immediately after the creation, but I noticed that when terraform fails to read the source-control resource the portal also shows an error on retrieving the github repo info.
I believe that it's something in the backend that is failing not terraform.
Same issue when trying to import a azurerm_app_service_source_control
With bitbucket as a repo url, so the stack trace is a little different.
Terraform version: 1.9.5 Azure rm version: 4.0.1
Seems like this is the original issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/3696
azurerm_app_service_source_control.bitbucket: Refreshing state... [id=/subscriptions/REDACTED/resourceGroups/REDACTED/providers/Microsoft.Web/sites/REDACTED]
╷
│ Error: reading Source Control for App Service (Subscription: "REDACTED"
│ Resource Group Name: "REDACTED"
│ Site Name: "REDACTED"): unexpected status 400 (400 Bad Request) with response: {"Code":"BadRequest","Message":"Repository 'GetSiteSourceControl' operation failed with System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.\r\n at System.ThrowHelper.ThrowKeyNotFoundException()\r\n at System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n at Microsoft.Web.Hosting.Administration.BitbucketSiteRepositoryProvider.<GetSiteSourceControl>d__2.MoveNext() in C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Providers\\BitbucketSiteRepositoryProvider.cs:line 29\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 Microsoft.Web.Hosting.Administration.WebCloudController.<>c__DisplayClass378_0.<<GetSiteSourceControl>b__0>d.MoveNext() in C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Controllers\\WebCloudController.cs:line 11379\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 Microsoft.Web.Hosting.AsyncHelper.RunSync[TResult](Func`1 func)\r\n at Microsoft.Web.Hosting.Administration.WebCloudController.GetSiteSourceControl(String subscriptionName, String webspaceName, String name).","Target":null,"Details":[{"Message":"Repository 'GetSiteSourceControl' operation failed with System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.\r\n at System.ThrowHelper.ThrowKeyNotFoundException()\r\n at System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n at Microsoft.Web.Hosting.Administration.BitbucketSiteRepositoryProvider.<GetSiteSourceControl>d__2.MoveNext() in C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Providers\\BitbucketSiteRepositoryProvider.cs:line 29\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 Microsoft.Web.Hosting.Administration.WebCloudController.<>c__DisplayClass378_0.<<GetSiteSourceControl>b__0>d.MoveNext() in C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Controllers\\WebCloudController.cs:line 11379\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 Microsoft.Web.Hosting.AsyncHelper.RunSync[TResult](Func`1 func)\r\n at Microsoft.Web.Hosting.Administration.WebCloudController.GetSiteSourceControl(String subscriptionName, String webspaceName, String name)."},{"Code":"BadRequest"},{"ErrorEntity":{"ExtendedCode":"05007","MessageTemplate":"Repository '{0}' operation failed with {1}.","Parameters":["GetSiteSourceControl","System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.\r\n at System.ThrowHelper.ThrowKeyNotFoundException()\r\n at System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n at Microsoft.Web.Hosting.Administration.BitbucketSiteRepositoryProvider.<GetSiteSourceControl>d__2.MoveNext() in C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Providers\\BitbucketSiteRepositoryProvider.cs:line 29\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 Microsoft.Web.Hosting.Administration.WebCloudController.<>c__DisplayClass378_0.<<GetSiteSourceControl>b__0>d.MoveNext() in C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Controllers\\WebCloudController.cs:line 11379\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 Microsoft.Web.Hosting.AsyncHelper.RunSync[TResult](Func`1 func)\r\n at Microsoft.Web.Hosting.Administration.WebCloudController.GetSiteSourceControl(String subscriptionName, String webspaceName, String name)"],"Code":"BadRequest","Message":"Repository 'GetSiteSourceControl' operation failed with System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.\r\n at System.ThrowHelper.ThrowKeyNotFoundException()\r\n at System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n at Microsoft.Web.Hosting.Administration.BitbucketSiteRepositoryProvider.<GetSiteSourceControl>d__2.MoveNext() in C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Providers\\BitbucketSiteRepositoryProvider.cs:line 29\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 Microsoft.Web.Hosting.Administration.WebCloudController.<>c__DisplayClass378_0.<<GetSiteSourceControl>b__0>d.MoveNext() in C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Controllers\\WebCloudController.cs:line 11379\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 Microsoft.Web.Hosting.AsyncHelper.RunSync[TResult](Func`1 func)\r\n at Microsoft.Web.Hosting.Administration.WebCloudController.GetSiteSourceControl(String subscriptionName, String webspaceName, String name)."}}],"Innererror":null}
│
│ reading Source Control for App Service (Subscription: "REDACTED"
│ Resource Group Name: "REDACTED"
│ Site Name: "REDACTED"): unexpected status 400 (400 Bad Request) with response: {"Code":"BadRequest","Message":"Repository
│ 'GetSiteSourceControl' operation failed with System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.\r\n at
│ System.ThrowHelper.ThrowKeyNotFoundException()\r\n at System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n at
│ Microsoft.Web.Hosting.Administration.BitbucketSiteRepositoryProvider.<GetSiteSourceControl>d__2.MoveNext() in
│ C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Providers\\BitbucketSiteRepositoryProvider.cs:line 29\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
│ Microsoft.Web.Hosting.Administration.WebCloudController.<>c__DisplayClass378_0.<<GetSiteSourceControl>b__0>d.MoveNext() in
│ C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Controllers\\WebCloudController.cs:line 11379\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
│ Microsoft.Web.Hosting.AsyncHelper.RunSync[TResult](Func`1 func)\r\n at
│ Microsoft.Web.Hosting.Administration.WebCloudController.GetSiteSourceControl(String subscriptionName, String webspaceName, String
│ name).","Target":null,"Details":[{"Message":"Repository 'GetSiteSourceControl' operation failed with System.Collections.Generic.KeyNotFoundException: The
│ given key was not present in the dictionary.\r\n at System.ThrowHelper.ThrowKeyNotFoundException()\r\n at
│ System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n at
│ Microsoft.Web.Hosting.Administration.BitbucketSiteRepositoryProvider.<GetSiteSourceControl>d__2.MoveNext() in
│ C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Providers\\BitbucketSiteRepositoryProvider.cs:line 29\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
│ Microsoft.Web.Hosting.Administration.WebCloudController.<>c__DisplayClass378_0.<<GetSiteSourceControl>b__0>d.MoveNext() in
│ C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Controllers\\WebCloudController.cs:line 11379\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
│ Microsoft.Web.Hosting.AsyncHelper.RunSync[TResult](Func`1 func)\r\n at
│ Microsoft.Web.Hosting.Administration.WebCloudController.GetSiteSourceControl(String subscriptionName, String webspaceName, String
│ name)."},{"Code":"BadRequest"},{"ErrorEntity":{"ExtendedCode":"05007","MessageTemplate":"Repository '{0}' operation failed with
│ {1}.","Parameters":["GetSiteSourceControl","System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.\r\n at
│ System.ThrowHelper.ThrowKeyNotFoundException()\r\n at System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n at
│ Microsoft.Web.Hosting.Administration.BitbucketSiteRepositoryProvider.<GetSiteSourceControl>d__2.MoveNext() in
│ C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Providers\\BitbucketSiteRepositoryProvider.cs:line 29\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
│ Microsoft.Web.Hosting.Administration.WebCloudController.<>c__DisplayClass378_0.<<GetSiteSourceControl>b__0>d.MoveNext() in
│ C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Controllers\\WebCloudController.cs:line 11379\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
│ Microsoft.Web.Hosting.AsyncHelper.RunSync[TResult](Func`1 func)\r\n at
│ Microsoft.Web.Hosting.Administration.WebCloudController.GetSiteSourceControl(String subscriptionName, String webspaceName, String
│ name)"],"Code":"BadRequest","Message":"Repository 'GetSiteSourceControl' operation failed with System.Collections.Generic.KeyNotFoundException: The given
│ key was not present in the dictionary.\r\n at System.ThrowHelper.ThrowKeyNotFoundException()\r\n at
│ System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n at
│ Microsoft.Web.Hosting.Administration.BitbucketSiteRepositoryProvider.<GetSiteSourceControl>d__2.MoveNext() in
│ C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Providers\\BitbucketSiteRepositoryProvider.cs:line 29\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
│ Microsoft.Web.Hosting.Administration.WebCloudController.<>c__DisplayClass378_0.<<GetSiteSourceControl>b__0>d.MoveNext() in
│ C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Controllers\\WebCloudController.cs:line 11379\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
│ Microsoft.Web.Hosting.AsyncHelper.RunSync[TResult](Func`1 func)\r\n at
│ Microsoft.Web.Hosting.Administration.WebCloudController.GetSiteSourceControl(String subscriptionName, String webspaceName, String
│ name)."}}],"Innererror":null}
╵
Is there an existing issue for this?
Community Note
I'm trying to create an app resource to deploy an azure sample app from public github repository, the creation is done successfully with no issues but when I try to run
terraform refresh
or when I try to redeploy after updating the configurations (i.e. runterraform deploy
) the deployment fails.Terraform Version
1.2.6
AzureRM Provider Version
"~> 3.78" , also tried with the latest version "~> 3.101.0"
Affected Resource(s)/Data Source(s)
resource azurerm_app_service_source_control
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Terraform command should end successfully, specially when no changes were done after the first deployment.
Actual Behaviour
the application fails with a traceback, the traceback shows windows file paths however the command is running on MacOS environment.
Steps to Reproduce
No response
Important Factoids
No response
References
No response