Hello…!!
I am trying to delete one of the app service created using terraform, So Current directory structure is as follows
The Code Hierarchy is as follows
-
module directory - containing list of modules
-
app_service_plan
-
app_service
- provider.tf
-
provider "azurerm" {
version = "3.54.0"
features {}
skip_provider_registration = true
}
* app_service.tf
resource "azurerm_windows_web_app" "webapp" {
name = "app_service"
location = var.location
resource_group_name = var.resource_group_name
service_plan_id = var.app_services_plan_id
site_config{...}
}
-
eastus - root directory to create azure resources
- main.tf
The app service is module is called and all other app service configuration is also passed.
We have around 3 app service defined in similar way, the issue is now we need to delete one of the app service since team isnt using any more.
- main.tf
module "app_service_xyz" {
source = "../../modules/app_service"
.....
}
* provider.tf
provider "azurerm" {
version = "3.54.0"
features {}
skip_provider_registration = true
}
Ideally when we remove / comment the configuration from main.tf it should destory the app service and dependent services. but in my case I am getting below error
but I am getting below error.
Error
To work with module.app_service_xyz.azurerm_windows_web_app.webapp its
original provider configuration at
module.app_service_xyz.provider[“Terraform Registry”] is
required, but it has been removed. This occurs when a provider configuration
is removed while objects created by that provider still exist in the state.
Re-add the provider configuration to destroy
module.app_service_xyz.azurerm_windows_web_app.webapp, after which you can
remove the provider configuration again.
Does any one has any idea, it would be very helpful. Dint found any easy or correct step guide to resolve this issue…