Terraform: `terraform plan` causes SIGSEGV

Created on 7 Nov 2017  ·  6Comments  ·  Source: hashicorp/terraform

Hi there, I was encountered SIGSEGV.

Terraform Version

  • Terraform v0.10.8
  • terraform-provider-aws v1.2.0

Terraform Configuration Files

Debug Output

I found crash.log but it includes business info, so I report only Crash Output 🙇

Crash Output

aws_sqs_queue.<sqs-name>: Refreshing state... (ID: https://sqs.ap-northeast-1.amazonaws.co...)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x1726bf1]

goroutine 1256 [running]:
github.com/hashicorp/terraform/terraform.(*NodeRefreshableManagedResourceInstance).evalTreeManagedResourceNoState(0xc420270548, 0x3, 0x1)
    /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/hashicorp/terraform/terraform/node_resource_refresh.go:218 +0x241
github.com/hashicorp/terraform/terraform.(*NodeRefreshableManagedResourceInstance).EvalTree(0xc420270548, 0x3035820, 0xc420270548)
    /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/hashicorp/terraform/terraform/node_resource_refresh.go:97 +0x71
github.com/hashicorp/terraform/terraform.(*Graph).walk.func1(0x3035820, 0xc420270548, 0x0, 0x0)
    /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/hashicorp/terraform/terraform/graph.go:113 +0xa3c
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc42031eb60, 0x3035820, 0xc420270548, 0xc4208a2900)
    /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/hashicorp/terraform/dag/walk.go:387 +0x3c1
created by github.com/hashicorp/terraform/dag.(*Walker).Update
    /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/hashicorp/terraform/dag/walk.go:310 +0x1364

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. rename aws_instance resource name
  2. $ terraform state mv aws_instance.foo aws_instance.bar

    • I might type $ terraform state mv aws_instance.foo <wrong resource such as aws_eip>.bar 😿

  3. $ terraform plan

Important Factoids

References

bug core crash

Most helpful comment

Thanks for that additional context, @koooge!

Indeed a failure is expected in that case, but we should handle it more elegantly than a panic...

All 6 comments

I checked my .tfstate and I found something wrong. Resource name is "aws_eip.bar": { in spite of "type": "aws_instance".
Apparently, I typed $ terraform state mv aws_instance.foo aws_eip.bar in step2...

...
   "modules": [
        {
            "path": [
                "root"
            ],
            "outputs": {},
            "resources": {},
            "depends_on": []
        },
       {
            "path": [
                "root",
                "compute"
            ],
            "outputs": {},
            "resources": {
                "aws_eip.bar": {
                    "type": "aws_instance",
...

Thanks for that additional context, @koooge!

Indeed a failure is expected in that case, but we should handle it more elegantly than a panic...

Hello,

Do you have any updates on this issue ?
Thanks

Having the same problem, terraform state rm and terraform state show on a resource of wrong type (after terraform mv a.foo b.foo) fails silently.

Hello! :robot:

This issue relates to an older version of Terraform that is no longer in active development, and because the area of Terraform it relates to has changed significantly since the issue was opened we suspect that the issue is either fixed or that the circumstances around it have changed enough that we'd need an updated issue report in order to reproduce and address it.

If you're still seeing this or a similar issue in the latest version of Terraform, please do feel free to open a new bug report! Please be sure to include all of the information requested in the template, even if it might seem redundant with the information already shared in _this_ issue, because the internal details relating to this problem are likely to be different in the current version of Terraform.

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