Terraform: 0.10.3 - Remote state lock release error, every apply

Created on 3 Sep 2017  ยท  3Comments  ยท  Source: hashicorp/terraform

This behavior appears to have started with terraform 10.3 and the only workaround I have atm is to disable state locking.

Terraform Version

0.10.3
go runtime 1.9

Affected Resource(s)

  • azurerm_resource_group
  • anything azure really, this this is tied to remote state

Terraform Configuration Files

variable "rg_name"                      { }
variable "location"                     { }

# Remote state data source, no interpolations allowed
terraform {
  backend "azurerm" {
    key = "***.terraform.tfstate"
    storage_account_name = "***"
    container_name       = "terraform-state"
  }
}

# Configure TF provider: Microsoft Azure
provider "azurerm" {
  version         = "~> 0.1"
  subscription_id = "***"
  client_id       = "***"
  client_secret   = "***"
  tenant_id       = "***"
}

resource "azurerm_resource_group" "bug_eastus" {
  name     = "${var.rg_name}"
  location = "${var.location}"
}

Debug Output

Terraform Init Output

Terraform Apply Output

Expected Behavior

Command returns upon completion

Actual Behavior

-Azure Rg successfully gets provisioned
-Lease on remote .tfstate Azure blob still shows 'leased', and must be manually broken

Steps to Reproduce

  1. terraform apply

Important Factoids

-I have confirmed this happens regardless of Azure storage account encryption at rest
-Appending a -lock=false to all terraform commands is the current workaround
-The repro steps were conducted on a fresh directory, with no .terraform folder created, or existing remote state file.
-Eventually this issue results in a .errorstate, which CAN be succesfully pushed if I manually delete the blob lease on the .tfstate blob

References

Originally posted here but told this behavior is part of TF core.

backenazure bug

Most helpful comment

Hey @samirageb @attachmentgenie

Thanks for reporting this issue - I've taken a look into this and opened PR #16015 which includes a fix for this issue.

Thanks!

All 3 comments

we see this behavior too using terraform 0.10.3 and azure plugin terraform-provider-azurerm_v0.1.5_x4

Hey @samirageb @attachmentgenie

Thanks for reporting this issue - I've taken a look into this and opened PR #16015 which includes a fix for this issue.

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