Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider.azurerm v1.22.0 crashes terraform v0.11.11 and causes error locking tfstate #39

Closed
enorlando opened this issue Feb 12, 2019 · 7 comments

Comments

@enorlando
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureAD Provider) Version

Affected Resource(s)

Terraform v0.11.11

  • provider.azuread v0.1.0
  • provider.azurerm v1.22.0

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

Panic Output

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x176c6a8]

goroutine 6110 [running]:
github.com/hashicorp/terraform/terraform.(*NodeRefreshableManagedResourceInstance).evalTreeManagedResourceNoState(0xc000308030, 0xa2176d0, 0xc0008480a0)
/private/tmp/terraform-20181217-80581-zpqwjg/terraform-0.11.11/src/github.com/hashicorp/terraform/terraform/node_resource_refresh.go:238 +0x328
github.com/hashicorp/terraform/terraform.(*NodeRefreshableManagedResourceInstance).EvalTree(0xc000308030, 0x3ae1700, 0xc000308030)
/private/tmp/terraform-20181217-80581-zpqwjg/terraform-0.11.11/src/github.com/hashicorp/terraform/terraform/node_resource_refresh.go:98 +0x6e
github.com/hashicorp/terraform/terraform.(*Graph).walk.func1(0x3ae1700, 0xc000308030, 0x0, 0x0)
/private/tmp/terraform-20181217-80581-zpqwjg/terraform-0.11.11/src/github.com/hashicorp/terraform/terraform/graph.go:113 +0x9a2
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc0009f8000, 0x3ae1700, 0xc000308030, 0xc0002fe2c0)
/private/tmp/terraform-20181217-80581-zpqwjg/terraform-0.11.11/src/github.com/hashicorp/terraform/dag/walk.go:387 +0x367
created by github.com/hashicorp/terraform/dag.(*Walker).Update
/private/tmp/terraform-20181217-80581-zpqwjg/terraform-0.11.11/src/github.com/hashicorp/terraform/dag/walk.go:310 +0x986

Expected Behavior

Terraform should have successfully run a plan.

Steps to Reproduce

  1. az login
  2. terraform init
  3. terraform plan -->causes panic
  4. terraform plan -->causes error locking state

Important Factoids

Below error when running terraform plan second time. When the tfstate state is leased in azure, it will lock again running a plan

Error: Error locking state: Error acquiring the state lock: storage: service returned error: StatusCode=409, ErrorCode=LeaseAlreadyPresent, ErrorMessage=There is already a lease present.
RequestId:b2592325-701e-004a-607e-c2a9a8000000
Time:2019-02-12T02:57:14.9888560Z, RequestInitiated=Tue, 12 Feb 2019 02:57:14 GMT, RequestId=b2592325-701e-004a-607e-c2a9a8000000, API Version=2016-05-31, QueryParameterName=, QueryParameterValue=
Lock Info:
ID: xxxxx
Path: xxxxxx
Operation: OperationTypePlan
Who: xxxxxx
Version: 0.11.11
Created: 2019-02-12 02:56:55.201233 +0000 UTC
Info:

Terraform acquires a state lock to protect the state from being written
by multiple users at the same time. Please resolve the issue above and try
again. For most commands, you can disable locking with the "-lock=false"
flag, but this is not recommended.

  • #0000
@ghost ghost added bug crash labels Feb 12, 2019
@katbyte
Copy link
Collaborator

katbyte commented Feb 14, 2019

Hi @enorlando

It looks like something in your configuration is causing terraform to panic, would you mind sharing with us some terraform config that triggers this crash so we can see whats going on? Thanks!

@enorlando
Copy link
Author

Hi @katbyte

I'm not sure where in the terraform config it is crashing. I have enabled trace logging and searched through the logs however it does not show me where it crashes during the plan. How can I pinpoint when it panic's as we have many terraform files for different azure configurations?

@ghost ghost removed the waiting-response label Feb 14, 2019
@tombuildsstuff
Copy link
Contributor

hi @enorlando

Taking a look into this - this error appears to be coming from a bug in the AzureRM Backend in Terraform Core, rather than something specific to this Provider. This bug exists in the Backend within Terraform 0.11 and was being tracked in this issue - however a fix for this has been merged and will ship as a part of Terraform 0.12.

At this time it should be possible to unlock the Blob File within the Storage Account and re-try again, which should give you the underlying error (which should tell us how to proceed with this) - would you be able to take a look?

Thanks!

@enorlando
Copy link
Author

Hi @tombuildsstuff

This is the error received when I break the lease from the Blob file and re-try Terraform Plan

Error: Error locking state: Error acquiring the state lock: storage: service returned error: StatusCode=409, ErrorCode=LeaseAlreadyPresent, ErrorMessage=There is already a lease present.
RequestId:22e11e46-f01e-005b-4c1d-c79eb3000000
Time:2019-02-18T00:04:17.2246370Z, RequestInitiated=Mon, 18 Feb 2019 00:04:16 GMT, RequestId=22e11e46-f01e-005b-4c1d-c79eb3000000, API Version=2016-05-31, QueryParameterName=, QueryParameterValue=
Lock Info:
ID: <>
Path: terraform/<>.terraform.tfstate
Operation: OperationTypePlan
Who: <>
Version: 0.11.11
Created: 2019-02-14 21:52:51.034163 +0000 UTC
Info:

Terraform acquires a state lock to protect the state from being written
by multiple users at the same time. Please resolve the issue above and try
again. For most commands, you can disable locking with the "-lock=false"
flag, but this is not recommended.

@ghost ghost removed the waiting-response label Feb 18, 2019
@enorlando
Copy link
Author

Hi @tombuildsstuff
Have you had a chance to look at the issue? What is the ETA for Terraform 0.12 release?
Thanks

@tombuildsstuff
Copy link
Contributor

hi @enorlando

Thanks for confirming that - this is a duplicate of hashicorp/terraform#17046 and as such I'm going to close it in favour of that issue, which has been resolved and the fix is available as of Terraform 0.12.

Regarding a release date for Terraform 0.12 - Beta 1 of Terraform 0.12 has recently been released however there's no more information about the release date available at this time, unfortunately.

Thanks!

@ghost
Copy link

ghost commented Apr 4, 2019

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants