Dreaded "Error: Insufficient features blocks"

hello, hoping someone else has run into this issue. i have a very strange issue using terraform cloud hooked up to azure devops services, when using remote plan execution. plan runs fine locally, when i commit the code the plan that runs on terraform cloud errors out saying

Error: Insufficient features blocks
│
│ on line 0:
│ (source code not available)
│
│ At least 1 “features” blocks are required.

below code reproduces the issue for me in a fresh repo and a fresh workspace (identifiers edited out)

terraform {
  cloud {
    organization = "xxx"
    workspaces {
      tags = ["xxx"]
    }
  }
}
provider "azurerm" {
  features { }
}
resource "azurerm_resource_group" "xxx-shared-resources-networks" {
    name     = "xxx-shared-resources-networks"
    location = "Central US"
}

honestly about to throw in the towel on using terraform cloud considering time spent on this as it genuinely seems like a bug, but i figured i’d do a hail mary here and see if the community could help.

Thanks in advance!

@shaun.m.potts

Hello Shaun,

This may not be it but, could you remove that space between the features { } like so features {} and try again?

thanks!

HI, similar problem - case is not in additional space for brakets or so.

how about this:

2 providers - “microsoft/azuredevops” and “hashicorp/azurerm”
normally (previously worked with azuredevops) the first provider doesn’t accept any features in provider block:

Error: Unsupported block type
│
│   on modules\ADO\provider.tf line 13, in provider "devops":
│   13:   features {}
│
│ Blocks of type "features" are not expected here.

when I’m removing features block - then I get:

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

WTF???

my providers looks like:

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 3.2.0"
    }
  }
}

provider "azurerm" {
  features {
    log_analytics_workspace {
      permanently_delete_on_destroy = true
    }
    resource_group {
      prevent_deletion_if_contains_resources = true
    }
    key_vault {
      purge_soft_delete_on_destroy               = true
      purge_soft_deleted_secrets_on_destroy      = true
      purge_soft_deleted_certificates_on_destroy = true
    }
  }
  skip_provider_registration = true
}

and

terraform {
  required_providers {
    devops = {
      source  = "microsoft/azuredevops"
      version = ">= 0.2.1"
    }
  }
}

provider "devops" {
  org_service_url       = var.ado_organization_url
  personal_access_token = var.ado_pat
}

and versions are:

Terraform v1.1.9
on windows_386
+ provider registry.terraform.io/hashicorp/azurerm v3.3.0
+ provider registry.terraform.io/hashicorp/random v3.1.3
+ provider registry.terraform.io/microsoft/azuredevops v0.2.1

(searching rest of a code for words provider/providers/etc… is not giving me any other matches - read that as there is no other places with provider definitions.)

even disabling (commenting) whole 2nd provider (azuredevops) and removing module/ADO from code tree - I’m getting the same error type.
Funny part:
before I started modifying code for azuredevops and it’s functions - the code was running correctly, now removing everything back is not - magic…