Terraform: Terraform 0.13.0 downloading unwanted version for -/azurerm provider

Created on 19 Aug 2020  ยท  3Comments  ยท  Source: hashicorp/terraform

Since upgrade to Terraform 0.13.0 terraform is always downloading the latest azurerm provider in addition to the requested version.

Terraform Version

Terraform v0.13.0
+ provider registry.terraform.io/-/azurerm v2.23.0
+ provider registry.terraform.io/hashicorp/azurerm v2.19.0

Terraform Configuration Files

terraform {
  backend "azurerm" {
    resource_group_name  = "terraform-rg"
    storage_account_name = "satestterraform"
    container_name       = "tfstate"
    key                  = "function_app"
  }
}

provider "azurerm" {
   version = "=2.19.0"
}

Debug Output

terraform init

Initializing the backend...

Successfully configured the backend "azurerm"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...

  • Finding latest version of -/azurerm...
  • Finding hashicorp/azurerm versions matching "2.19.0"...
  • Using -/azurerm v2.23.0 from the shared cache directory
  • Using hashicorp/azurerm v2.19.0 from the shared cache directory

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, we recommend adding version constraints in a required_providers block
in your configuration, with the constraint strings suggested below.

  • -/azurerm: version = "~> 2.23.0"

Terraform has been successfully initialized!

Crash Output

Expected Behavior

Should only download specified provider version hashicorp/azurerm v2.19.0

Actual Behavior

Downloaded the requested version and -/azurerm v2.23.0 (latest)

Steps to Reproduce

  1. terraform init

Additional Context

Worked without any issues using terraform 0.12.29

References

bug new

Most helpful comment

Hey @andrew-sumner!

I think doing state replace-provider should fix this issue! You can find more information about this command here: https://www.terraform.io/upgrade-guides/0-13.html

terraform state replace-provider 'registry.terraform.io/-/azurerm' 'registry.terraform.io/hashicorp/azurerm'

All 3 comments

Hey @andrew-sumner!

I think doing state replace-provider should fix this issue! You can find more information about this command here: https://www.terraform.io/upgrade-guides/0-13.html

terraform state replace-provider 'registry.terraform.io/-/azurerm' 'registry.terraform.io/hashicorp/azurerm'

I can second @TomTucka 's suggestion, though it's worth noting that it's not going to cause any issues from terraform's perspective. This is a duplicate of #25771; you can see my explanation in this comment. Thanks!

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings