If you are familiar with Terraform, you might have experience with terraform state import, which allows to import state of the already provisioned resources and generate an infra script. This blog explains about an error which occurred when trying do terraform state import and the fix for it.
When trying to import the state of Azure app service plan as shown in the following command, it gives a error.
Terraform command :
Terraform import azurerm_app_service_plan.serviceplan /subscriptions/mysubscription /resourceGroups/myresource group/providers/Microsoft.Web/serverFarms/myplanname
Following is the error occurred.
Error: Error parsing Resource ID "/subscriptions/mysubscription/resourceGroups/myresourcegroup/providers/Microsoft.Web/serverFarms/myplanname": ID was missing the `serverfarms` element
If you look at the error message it complains, serverfarms element is missing in the resource id provided in the command. But, you can see, the value is actually provided in the command.
Cause:
Reason for the failure is terraform unable to identify 'serverfarms' word due to caps use in the resource id generated by azure.
Fix:
use serverfarms instead of serverFarms in the resource id and rerun the command. You would be able to import the state of azure app service plan successfully.
This blog explained a simple issue occurred while importing state of the azure app service plan and how to fix it.
No comments:
Post a Comment