Using Terraform and came across this error: “subscription_id is a required provider property when performing a plan/apply operation”? This blog post is for you – a quick post on how to fix this and get you back to deploying using Terraform
Full error output
Lets look quickly at the full output when trying to run terraform plan or terraform apply:
Planning failed. Terraform encountered an error while generating this plan.
╷
│ Error: `subscription_id` is a required provider property when performing a plan/apply operation
│
│ with provider["registry.terraform.io/hashicorp/azurerm"],
│ on providers.tf line 7, in provider "azurerm":
│ 7: provider "azurerm" {
│
Why has this Terraform error started to appear?
Specifying subscription_id is a mandatory change in Terraform version 4.0 of Azure Provider.
In version 4.0 of the Azure Provider, it’s now required to specify the Azure Subscription ID when configuring a provider instance in your configuration.
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide#specifying-subscription-id-is-now-mandatory
The fix
- Add
subscription_idas part of your providerazurermblock:
provider "azurerm" {
features {}
subscription_id = "0000000-0000-00000-000000"
}
Remember to run terraform init after making changes to your provider configuration to ensure everything is properly initialised.
The fix is very simple, but thought I would add it to this blog post if you ever happen to come across it 🙂
Thank you
Glad it helped you!
Great 😀
Glad you found it useful 🙂
Still relevant thx
Thank you – glad to hear that!