Features block terraform

Viewed 19260

terraform init successfully initializes but gets stuck on terraform plan.

The error is related to the feature block. I'm unsure where to add the feature block:

Insufficient features blocks (source code not available) At least 1 "features" blocks are required.

My configuration looks like

terraform {
  required_version = ">= 0.11"

  backend "azurerm" {
    features {}
   }
 }

I tried removing and adding features block as github page

4 Answers

When you run updated version of terraform you need to define another block defined below

provider "azurerm" {
   features {}
}

An other reason for the message could be, that a named provider is in use:

provider "azurerm" {
  alias = "some_name" # <- here
  features {}
}

But not specified on the resource:

resource "azurerm_resource_group" "example" {
  # might this block is missing
  # -> provider = azurerm.some_name
  name     = var.rg_name
  location = var.region
}

Error message:

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

In Terraform >= 0.13, here's what a sample versions.tf looks like (note the provider config being in a separate block):

# versions.tf
terraform {
  required_providers {
    azurerm = {
      # ...
    }
  }
  required_version = ">= 0.13"
}

# This block goes outside of the required_providers block!
provider "azurerm" {
  features {}
}

Please check if highlighted lines are added to your template

Please check if highlighted lines are added to your template

Related