'terraform azure insufficient blocks

Here is my terraform plan

terraform {
    required_providers {
        azure = {
            source = "hashicorp/azurerm"
            version = "=3.5.0"
        }
    }
    backend "s3" {
        encrypt = true
        bucket = "terraform"
        region = "us-east-1"
        key = "aws/tgw_peer/us-east-1/terraform.tfstate"
    }
}



provider "azurerm" {
    features {}
}


data "azurerm_virtual_network" "vnet" {
    resource_group_name = var.resource_group_name
    name = var.vnet_name
}

When I execute terraform plan I get the following error:

╷
│ Error: Insufficient features blocks
│
│   on <empty> line 0:
│   (source code not available)
│
│ At least 1 "features" blocks are required.
╵

There is clearly a features block in the azurerm provider block. However, the fact that the error doesn't specify the file name tells me that maybe the problem is somewhere else. What am I doing wrong? Terraform version 1.1.6



Solution 1:[1]

The name of the provider in the required_providers block is wrong, you have set it to azure while it should be azurerm. Example of how to configure the provider:

terraform {
  required_providers {
    azurerm = { # <--- Note that it is azurerm
      source = "hashicorp/azurerm"
      version = "3.5.0"
    }
  }
}

provider "azurerm" {
  # Configuration options
}

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 Marko E