Hi
I have multiple subscriptions and require to place resources in different subscriptions during an apply.
my global.tf includes:
terraform {
required_version = "~>0.15"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.66.0"
}
azuread = {
source = "hashicorp/azuread"
version = "~>1.5.0"
}
cloudinit = {
source = "hashicorp/cloudinit"
version = "=2.2.0"
}
}
backend "azurerm" {
storage_account_name = "xxxx"
container_name = "tfstate"
key = "nextgen.terraform.state"
}
}
# This is our default subscription with core infra
provider "azurerm" {
features {}
alias = "default"
subscription_id = "xxx"
tenant_id = "yyy"
}
# This is the subscription we want to deploy to
provider "azurerm" {
features {}
alias = "internal"
subscription_id = module.client2sub.subscription_id
tenant_id = "yyy"
}
I have several modules with each having a main.tf including:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.66.0"
configuration_aliases = [ azurerm.default, azurerm.internal ]
}
}
}
then when i call a module I use:
module "peer_networks" {
# depends_on = [module.networking]
for_each = toset(var.environments)
source = "../modules/vnet_peering"
providers = {
azurerm.default = azurerm.default
azurerm.internal = azurerm.internal
}
connect_to_workbench = local.connect_to_workbench
rg_name = module.resource_group.rg[each.key].name
location = var.location
vnet_source = module.networking.vnet_object[each.key]
vnet_regional_hub = data.azurerm_virtual_network.hub_vnet_regional_hub
vnet_us_hub = data.azurerm_virtual_network.hub_vnet_us
vnet_eu_hub = data.azurerm_virtual_network.hub_vnet_eu
subscription = module.client2sub.subscription_id
}
When I apply, I am getting:
│ Error: Insufficient features blocks
│
│ on line 0:
│ (source code not available)
│
│ At least 1 "features" blocks are required.
╵
But I have the features block defined in my global.
TF 15.5 / 1.0.1 tried out.
Any ideas?
1 Like
Got the same issue. terraform 0.15.3/1.0.3
After a several hours of total headache it was fixed by adding an empty azurerm provider block into configuration:
#region Azure aliased providers
provider "azurerm" {
alias = "stage1"
subscription_id = "yyy"
tenant_id = "xxx"
features {}
}
provider "azurerm" {
alias = "prod1"
subscription_id = "yyy"
tenant_id = "xxx"
features {}
}
#endregion
provider "azurerm" {
features {}
}
1 Like
terraform {
backend "local" {}
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
}
}
provider "azurerm" {
features {}
}
I am still getting the below error
│ Error: Insufficient features blocks
│
│ on line 0:
│ (source code not available)
│
│ At least 1 “features” blocks are required.
╵
Any thoughts ? I used dummy credentials instead of originals, is that a problem ? or is it related to code ?
For anyone else who stumbles across this, since I assume OP has resolved their issue:
If all of your providers are aliased, you have no default. This means EVERY resource from that provider will need the provider property set. If you have a resource from that provider that does not have a provider specified, Terraform creates and empty provider config, hence the “insufficient features blocks”.
1 Like
Hello, were anyone able to resolve this? I am facing the same issue with a single provider config as well even after adding the empty features block. My provider configuration file looks as below:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "2.92.0"
}
}
}
provider "azurerm" {
# Configuration options
features {}
}
I am still getting the below error
Error: Insufficient features blocks
│
│ on line 0:
│ (source code not available)
│
│ At least 1 “features” blocks are required.
Please let me know if there is anything wrong in this configuration and if so how to resolve this. Any help is much appreciated.
could you share more of your code?
Which terraform version are you using?
Hello guys, i am new to terraform in azure and still getting the error above even after following the directions provided. I am using terraform
terraform {
required_version = “>= 1.0.0”
required_providers {
azurerm = {
source = “hashicorp/azurerm”
version = “~> 3”
}
}
backend “remote” {
hostname = “app.terraform.io”
organization = “test”
workspaces {
name = “test-remote”
}
}
}
provider “azurerm” {
features { }
}
Create a resource group
resource “azurerm_resource_group” “example” {
name = “example-resources”
location = “West Europe”
}
any idea what i might be missing? i have tried terraform 1.0.0, 1.0.3, 1.0.11 and even older versions like 0.14.2, 0.15.0 but no luck