Skip to content
New issue

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

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

Already on GitHub? # to your account

Terraform crash when refreshing state #21587

Closed
auberta2 opened this issue Jun 4, 2019 · 5 comments
Closed

Terraform crash when refreshing state #21587

auberta2 opened this issue Jun 4, 2019 · 5 comments

Comments

@auberta2
Copy link

auberta2 commented Jun 4, 2019

Terraform Version

Terraform v0.12.0
+ provider.aws v2.13.0
+ provider.random v2.1.2

Terraform Configuration Files

Configuration files have nothing special and were used to run in some other accounts.

Debug Output

https://gist.github.com/auberta2/cb00f2ba24fb85fb475885a8978f49de

Crash Output

https://gist.github.com/auberta2/cb00f2ba24fb85fb475885a8978f49de

Expected Behavior

Terraform refresh of the state should succeed

Actual Behavior

terraform crashes after or during refresh of the state of the resources.

Steps to Reproduce

It crashes on commands like terraform plan, apply, refresh or even destroy.
Still, taint command is working

Additional Context

Running on MacOS within a workspace named dev having state remotely managed in S3

References

not as far as I know

@jbardin
Copy link
Member

jbardin commented Jun 4, 2019

Thanks for filing this issue @auberta2!

This appears to be another case of a missing Current state

The relevant stack trace:

github.com/hashicorp/terraform/terraform.(*evaluationStateData).getResourceInstancesAll(0xc000274a20, 0x4d, 0xc00061d620, 0xc, 0xc00061d630, 0xb, 0xc00058a730, 0xb, 0x16c, 0x1c, ...)
	/opt/gopath/src/github.com/hashicorp/terraform/terraform/evaluate.go:704 +0x11a3
github.com/hashicorp/terraform/terraform.(*evaluationStateData).GetResourceInstance(0xc000274a20, 0x4d, 0xc00061d620, 0xc, 0xc00061d630, 0xb, 0x0, 0x0, 0xc00058a730, 0xb, ...)
	/opt/gopath/src/github.com/hashicorp/terraform/terraform/evaluate.go:593 +0x1360
github.com/hashicorp/terraform/lang.(*Scope).evalContext(0xc000b66460, 0xc000266218, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x43a6140)
	/opt/gopath/src/github.com/hashicorp/terraform/lang/eval.go:253 +0xfcc
github.com/hashicorp/terraform/lang.(*Scope).EvalContext(...)
	/opt/gopath/src/github.com/hashicorp/terraform/lang/eval.go:160
github.com/hashicorp/terraform/lang.(*Scope).EvalExpr(0xc000b66460, 0x2be8580, 0xc0006172c0, 0x2be9880, 0xc0000c636f, 0xa, 0x28565b8, 0x1, 0x10cf0e0, 0xc0000e6693, ...)
	/opt/gopath/src/github.com/hashicorp/terraform/lang/eval.go:87 +0xb3
github.com/hashicorp/terraform/terraform.(*BuiltinEvalContext).EvaluateExpr(0xc00050bc70, 0x2be8580, 0xc0006172c0, 0x2be9880, 0xc0000c636f, 0x0, 0x0, 0x10cfec1, 0xc000134100, 0xc00061d610, ...)
	/opt/gopath/src/github.com/hashicorp/terraform/terraform/eval_context_builtin.go:284 +0x1e4
github.com/hashicorp/terraform/terraform.evaluateResourceCountExpressionKnown(0x2be8580, 0xc0006172c0, 0x2c166c0, 0xc00050bc70, 0xc000c7db10, 0x145c3d1, 0x27b9803, 0x5, 0xc000c7daf0)
	/opt/gopath/src/github.com/hashicorp/terraform/terraform/eval_count.go:55 +0xac
github.com/hashicorp/terraform/terraform.evaluateResourceCountExpression(0x2be8580, 0xc0006172c0, 0x2c166c0, 0xc00050bc70, 0xc000c7db90, 0x80, 0x3b524e0, 0x436e928)
	/opt/gopath/src/github.com/hashicorp/terraform/terraform/eval_count.go:28 +0x67
github.com/hashicorp/terraform/terraform.(*NodeRefreshableManagedResource).DynamicExpand(0xc0000b6938, 0x2c166c0, 0xc00050bc70, 0x0, 0x0, 0x0)
	/opt/gopath/src/github.com/hashicorp/terraform/terraform/node_resource_refresh.go:36 +0x8a

@auberta2
Copy link
Author

auberta2 commented Jun 4, 2019

The stack trace looks much similar you're right. Any known workaround waiting for a fix ?

@auberta2
Copy link
Author

auberta2 commented Jun 11, 2019

Upon investigation of the logs, I could workaround the bug by running :
terraform state rm aws_instance.backend-win

where backend-win was a collection of EC2 instances with a variable based count property

@jbardin
Copy link
Member

jbardin commented Jul 8, 2019

closed by #21979

@jbardin jbardin closed this as completed Jul 8, 2019
@ghost
Copy link

ghost commented Aug 13, 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 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.

@ghost ghost locked and limited conversation to collaborators Aug 13, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

2 participants