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_linux_function_app unable to configure source control similar to Deployment centre #23401

Open ro6it opened 1 year ago

ro6it commented 1 year ago

Is there an existing issue for this?

Community Note

Description

I am trying to configure the azurerm_linux_function_app with a source control (SCM), ExternalGit but I am not able to find any argument references. Although I'm able to achieve the same for Azure portal but as per my use case I need to automate this using Terraform instead of creating it manually by going on Azure console.

Please add this for the resource block.

New or Affected Resource(s)/Data Source(s)

azurerm_linux_function_app

Potential Terraform Configuration

No response

References

No response

ro6it commented 1 year ago

Checked the documentation for azurerm_app_service_source_control, currently it doesn't support function app https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service_source_control#arguments-reference

rcskosir commented 1 year ago

@ro6it Thank you for taking the time to open this feature request!

ro6it commented 1 year ago

For now, just as a workaround I have to use azurerm_function_app resource block for source_control functionality. However, azurerm_function_app resource has been deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0.

Requesting you to please add the source_control functionality in the azurerm_linux_function_app resource.

Plan: 1 to add, 1 to change, 0 to destroy. ╷ │ Warning: Deprecated Resource │ │ with module.loadbalancer_dns.azurerm_function_app.example, │ on module/loadbalancer_dns/functionapp.tf line 167, in resource "azurerm_function_app" "example": │ 167: resource "azurerm_function_app" "example" { │ │ The azurerm_function_app resource has been superseded by the azurerm_linux_function_app and azurerm_windows_function_app resources. Whilst this resource will continue to be │ available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the │ Azure Provider. │ │ (and one more similar warning elsewhere)

gittyNico commented 6 months ago
resource "azapi_update_resource" "source_control_function" {
  type      = "Microsoft.Web/sites/sourcecontrols@2022-09-01"
  name      = "web"
  parent_id = azurerm_windows_function_app.this.id
  body = jsonencode({
    properties = {
      branch              = var.git_branch
      isManualIntegration = true
      repoUrl             = var.git_repo_url
    }
    kind = "functionapp"
  })
}
ro6it commented 6 months ago

module.loadbalancer_dns.azapi_update_resource.source_control_function: Still creating... [50s elapsed] ╷ │ Error: Failed to update resource │ │ with module.loadbalancer_dns.azapi_update_resource.source_control_function, │ on ../../module/loadbalancer_dns/functionapp.tf line 94, in resource "azapi_update_resource" "source_control_function": │ 94: resource "azapi_update_resource" "source_control_function" { │ │ updating "Resource: (ResourceId │ \"/subscriptions/4af28428-fadd-42d1-ba1c-ba3eef6d4a6c/resourceGroups/Cisco_ISE_RG_NEW/providers/Microsoft.Web/sites/ise-function-app-tuc3/sourcecontrols/web\" / Api │ Version \"2022-09-01\")": PUT │ https://management.azure.com/subscriptions/4af28428-fadd-42d1-ba1c-ba3eef6d4a6c/resourceGroups/Cisco_ISE_RG_NEW/providers/Microsoft.Web/sites/ise-function-app-tuc3/sourcecontrols/web │ -------------------------------------------------------------------------------- │ RESPONSE 400: 400 Bad Request │ ERROR CODE UNAVAILABLE │ -------------------------------------------------------------------------------- │ { │ "Code": "BadRequest", │ "Message": "Repository 'UpdateSiteSourceControl' operation failed with System.TimeoutException: Operation GET https://waws-prod-blu-415.api.azurewebsites.windows.net/api/sshkey?ensurePublicKey=True exceeded 50000ms timeout!\r\n at Microsoft.Web.Hosting.Administration.Utilities.WebRequestHelper.<GetResponseAsyncWithTimeout>d__10.MoveNext() in C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Utilities\\WebRequestHelper.cs:line 65\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.SiteRepositoryProvider.TrackerContext.<GetResponseAsync>d__41.MoveNext() in C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Providers\\SiteRepositoryProvider.cs:line 756\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.SiteRepositoryProvider.<GetSSHKey>d__29.MoveNext() in C:\\__w\\1\\s\\src\\Hosting\\AdministrationService\\Microsoft.Web.Hosting.Administration\\Providers\\SiteRepositoryProvider.cs:line 321\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n

Observing timeout in both the case using null_resource az cli and the above suggested resource.