'Terraform azure provider gave me "features required field not set"

This code gave me error, even with the feature block.

terraform {
  required_version = ">= 0.12" 
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=2.46.0"
    }
  }
  
}

provider "azurerm" {
  tenant_id       = "xxxxx"
  subscription_id = "xxxxx"
  client_id       = "xxxxx"
  client_secret   = "xxxxx"
  alias           = "prod"
  features {}
}

What's wrong??? For azurerm version 2.0, I know features block is needed but I tried several times the error always comes up.



Solution 1:[1]

I just hit this today and when I removed alias field it worked! Related to this bug: https://github.com/hashicorp/terraform/issues/26312#issuecomment-801468683

Solution 2:[2]

This problem already solved,..

Actually, i need "alias" here because i'm using terraform for multi-subscriptions deployment..

For every resource blocks, i just need a "provider" attribut to define the provider they use.. in my case:

provider = azurem.prod

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitry Tokarev
Solution 2 Heri Fauzan