Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform azurerm 2.x Error: "features": required field is not set

So azurerm updated to 2.0 a few hours ago....

My main code is version locked for safety, but I'm doing some testing to see what's changed from the public beta of 1.44 and now I'm getting this error on any TF command apart from terraform init.

has anybody else come upon this?

like image 242
Marcus Adams Avatar asked Feb 24 '20 22:02

Marcus Adams


People also ask

Why can't I upgrade my terraform?

The answer is simply that your provider is missing the required features block (this can even be empty). I believe that the issue here is that the upgrade command expects the terraform that's being upgrade to be valid 0.11 code. And in 0.11, the type fields are expected to have string values (e.g. "map", "string", etc...).

Is it possible to fix azurerm version 2?

You could also fix the azurerm provider version to the last stable version 1.44: Yes, you could, however, you would not then be able to use the new features that 2.0 gives.

How do I authenticate terraform to Azure?

Terraform supports a number of different methods for authenticating to Azure: 1 Authenticating to Azure using the Azure CLI 2 Authenticating to Azure using Managed Service Identity 3 Authenticating to Azure using a Service Principal and a Client Certificate 4 Authenticating to Azure using a Service Principal and a Client Secret More ...

What is container_name in TerraForm?

container_name - (Required) The Name of the Storage Container within the Storage Account. key - (Required) The name of the Blob used to retrieve/store Terraform's State file inside the Storage Container. environment - (Optional) The Azure Environment which should be used.


1 Answers

OK, running terraform in debug mode showed it was at the provider level that the error was being thrown.

It's not listed in the 2.0 upgrade guide but if you look at the provider docs it now shows a features{} block.

So at a minimum the provider now needs to look like:

provider "azurerm" {
   features {}
}
like image 195
Marcus Adams Avatar answered Oct 07 '22 19:10

Marcus Adams