Quick Fix: Resolving the ‘subscription_id is a required provider property’ Error in Terraform

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_id as part of your provider azurerm block:
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 🙂

6 thoughts on “Quick Fix: Resolving the ‘subscription_id is a required provider property’ Error in Terraform”

Leave a Reply

Discover more from Thomas Thornton Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading

Discover more from Thomas Thornton Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading