Hi @Ridma Kakani,
It seems like the issue that you are facing could be related to how your Terraform pipeline is configured. When you run the Terraform pipeline, it could be making changes that are inadvertently impacting the Azure Web App configuration, such as resetting the container image to a default or blank state.
In order to troubleshoot this, try the following:
- Check your Terraform scripts to determine whether there are configuration settings that may be resetting the web app configuration or the container image. Verify that the image property is correctly set to the desired Docker image.
- Ensure that the Terraform state file is properly handling the current state of your Azure resources. If the state file gets out of sync with the actual resources, this could result in unexpected behavior.
- Before applying changes, review the output of the terraform plan to determine what changes Terraform intends to make. This can help identify if it is trying to modify the container image or other properties of the web app.
- Make sure that the application pipeline should deploy after the infrastructure pipeline if the infrastructure changes are necessary for the application to function correctly.
- Check the logs of both the Terraform pipeline and the Azure Web App for any message that could be making the image be removed.
By reviewing these details, you could be able to know why the previously deployed image is being removed upon running the Terraform pipeline.
Kindly refer to the below documentations for better understanding:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-azure-devops?tabs=csharp%2Cwindows&pivots=v1#deploy-a-container
https://learn.microsoft.com/en-us/azure/container-apps/azure-pipelines#deploy-to-azure-container-apps-from-azure-pipelines
https://learn.microsoft.com/en-us/azure/migrate/tutorial-app-containerization-azure-pipeline
If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.
Let me know if you have any further Queries.