Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Features block terraform

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

like image 998
cloudcop Avatar asked Apr 13 '20 00:04

cloudcop


People also ask

What is Features Block in Terraform?

features - (Required) A features block as defined below which can be used to customize the behaviour of certain Azure Provider resources. client_id - (Optional) The Client ID which should be used. This can also be sourced from the ARM_CLIENT_ID Environment Variable.

What is Terraform AzureRM?

The AzureRM Terraform Provider allows managing resources within Azure Resource Manager. When using version 3.0 of the AzureRM Provider we recommend using Terraform 1.

How do I update my AzureRM?

The command you need to run is in the help text you posted. Use Install-Module -Force AzureRM . See the -Force tag. Once you've updated the bootstrapper, run Install-AzureRM to install the new packages.


4 Answers

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

provider "azurerm" {
   features {}
}
like image 121
cloudcop Avatar answered Oct 19 '22 05:10

cloudcop


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.
like image 26
Patrick Avatar answered Oct 19 '22 05:10

Patrick


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 {}
}

like image 29
cody.codes Avatar answered Oct 19 '22 05:10

cody.codes


Please check if highlighted lines are added to your template

Please check if highlighted lines are added to your template

like image 1
Mohan Sharma Avatar answered Oct 19 '22 04:10

Mohan Sharma