hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io
Other
42.78k stars 9.56k forks source link

Terraform Crash during Terraform apply #20180

Closed lizhifan closed 5 years ago

lizhifan commented 5 years ago

Terraform Version

Terraform v0.11.11

Terraform Configuration Files

resource "aws_s3_bucket" "bucket" {
  bucket = "bucket"
  acl    = "private"
  cors_rule {
    allowed_headers = ["*"]
    allowed_methods = ["GET", "HEAD"]
    allowed_origins = ["*"]
    max_age_seconds = 86400
  }
  logging {
    target_bucket = "target-bucket"
    target_prefix = "s3-logs/"
  }
   website {
    index_document = "index.html"
  }

  replication_configuration {
    role = "${module.bucket-replication.replication-role-arn}"
    rules {
      destination {
        bucket = "${module.bucket-replication.bucket-dr-arn}"
        replica_kms_key_id = "${data.aws_kms_key.east-s3.arn}"
      }

      id = "replication-role-for-bucket"
      priority = 1
      source_selection_criteria {
        sse_kms_encrypted_objects {
          enabled = true
        }
      }

      status = "Enabled"

    }
  }

}

Debug Output

Crash Output

2019/01/31 17:48:32 [INFO] Terraform version: 0.11.11  
2019/01/31 17:48:32 [INFO] Go runtime version: go1.11.4
2019/01/31 17:48:32 [INFO] CLI args: []string{"/usr/local/Cellar/terraform/0.11.11/bin/terraform", "apply"}
2019/01/31 17:48:32 [DEBUG] Attempting to open CLI config file: /Users/lizhifan/.terraformrc
2019/01/31 17:48:32 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/01/31 17:48:32 [INFO] CLI command args: []string{"apply"}

2019/01/31 17:48:32 [INFO] command: empty terraform config, returning nil
2019/01/31 17:48:32 [TRACE] Preserving existing state lineage "ebdf2718-a158-36a6-9c63-dce214ec779d"
2019/01/31 17:48:32 [TRACE] Preserving existing state lineage "ebdf2718-a158-36a6-9c63-dce214ec779d"
2019/01/31 17:48:32 [INFO] command: backend initialized: <nil>
2019/01/31 17:48:32 [DEBUG] checking for provider in "."
2019/01/31 17:48:32 [DEBUG] checking for provider in "/usr/local/Cellar/terraform/0.11.11/bin"
2019/01/31 17:48:32 [DEBUG] checking for provider in ".terraform/plugins/darwin_amd64"
2019/01/31 17:48:32 [DEBUG] found provider "terraform-provider-aws_v1.57.0_x4"
2019/01/31 17:48:32 [DEBUG] found valid plugin: "aws", "1.57.0", 
...
2019/01/31 17:48:33 [TRACE] Graph after step *terraform.ConfigTransformer:

aws_s3_bucket.bucket - *terraform.NodeAbstractResource

Expected Behavior

Terraform will perform the following actions:

  ~ aws_s3_bucket.bucket
      acl:           "" => "private"
      force_destroy: "" => "false"

  ~ module.bucket-replication.aws_s3_bucket.bucket-dr
      acl:           "" => "private"
      force_destroy: "" => "false"

Plan: 0 to add, 2 to change, 0 to destroy.

Actual Behavior

panic: interface conversion: interface {} is nil, not map[string]interface {}
2019-02-01T10:45:18.800-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: 
2019-02-01T10:45:18.800-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: goroutine 5945 [running]:
2019-02-01T10:45:18.800-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsS3BucketReplicationConfigurationUpdate(0xc00114a5b8, 0xc0007f9960, 0x19, 0x1)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_s3_bucket.go:1934 +0x1b7d
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsS3BucketUpdate(0xc0007f9960, 0x3e87de0, 0xc0007af000, 0x24, 0x7a22080)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_s3_bucket.go:731 +0x524
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc0012f9dc0, 0xc001310a00, 0xc0006436a0, 0x3e87de0, 0xc0007af000, 0x100b601, 0xc000089b80, 0x10bdabc)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:231 +0x250
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc000df7d50, 0xc0013109b0, 0xc001310a00, 0xc0006436a0, 0xc000075800, 0x18, 0x9099d80)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0x9c
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc000640e80, 0xc000643240, 0xc000655350, 0x0, 0x0)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:527 +0x57
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: reflect.Value.call(0xc0001566c0, 0xc00114bac0, 0x13, 0x45329c7, 0x4, 0xc000089f18, 0x3, 0x3, 0xc00013a100, 0xc0003b3400, ...)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/goenv/versions/1.11.4/src/reflect/value.go:447 +0x454
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: reflect.Value.Call(0xc0001566c0, 0xc00114bac0, 0x13, 0xc0005a6f18, 0x3, 0x3, 0x1b, 0x0, 0xc000a4b640)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/goenv/versions/1.11.4/src/reflect/value.go:308 +0xa4
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: net/rpc.(*service).call(0xc001209ac0, 0xc000536d20, 0xc0006be2e8, 0xc0006be300, 0xc000f15500, 0xc000641740, 0x384f440, 0xc000643240, 0x16, 0x384f480, ...)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/goenv/versions/1.11.4/src/net/rpc/server.go:384 +0x14e
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: created by net/rpc.(*Server).ServeCodec
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/goenv/versions/1.11.4/src/net/rpc/server.go:481 +0x47e
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalWriteState
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalIf
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalWriteState
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalWriteDiff
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalApplyPost
2019/02/01 10:45:18 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* aws_s3_bucket.figma-alpha-api: unexpected EOF
2019/02/01 10:45:18 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* aws_s3_bucket.figma-alpha-api: unexpected EOF
2019/02/01 10:45:18 [TRACE] [walkApply] Exiting eval tree: aws_s3_bucket.figma-alpha-api
2019/02/01 10:45:18 [TRACE] dag/walk: upstream errored, not walking "provider.aws (close)"
2019/02/01 10:45:18 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2019/02/01 10:45:18 [TRACE] dag/walk: upstream errored, not walking "root"
2019-02-01T10:45:18.805-0800 [DEBUG] plugin: plugin process exited: path=/Users/lizhifan/figma/figma/config/terraform/prod/us-west-2/.terraform/plugins/darwin_amd64/terraform-provider-aws_v1.57.0_x4
2019/02/01 10:45:18 [TRACE] Preserving existing state lineage "bbb9ed33-3d8a-fd69-6079-acdd2e010423"
2019/02/01 10:45:18 [TRACE] Preserving existing state lineage "bbb9ed33-3d8a-fd69-6079-acdd2e010423"
2019/02/01 10:45:18 [TRACE] Preserving existing state lineage "bbb9ed33-3d8a-fd69-6079-acdd2e010423"
2019/02/01 10:45:18 [TRACE] Preserving existing state lineage "bbb9ed33-3d8a-fd69-6079-acdd2e010423"
2019/02/01 10:45:18 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-02-01T10:45:18.860-0800 [WARN ] plugin: error closing client during Kill: err="connection is shut down"

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
apparentlymart commented 5 years ago

Hi @lizhifan! Sorry for this crash.

Unfortunately without the full crash output we can't really know which component failed here. If you still have the part of the output that included the TERRAFORM CRASH header, including a line prefixed with panic: and a stack trace of what function was being called when the crash occurred, could you please share it? That will allow us to better see which component crashed and thus begin to figure out the cause.

lizhifan commented 5 years ago
Error: Error applying plan:

1 error(s) occurred:

* aws_s3_bucket.figma-alpha-api: 1 error(s) occurred:

* aws_s3_bucket.figma-alpha-api: unexpected EOF

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

panic: interface conversion: interface {} is nil, not map[string]interface {}
2019-02-01T10:45:18.800-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: 
2019-02-01T10:45:18.800-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: goroutine 5945 [running]:
2019-02-01T10:45:18.800-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsS3BucketReplicationConfigurationUpdate(0xc00114a5b8, 0xc0007f9960, 0x19, 0x1)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_s3_bucket.go:1934 +0x1b7d
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsS3BucketUpdate(0xc0007f9960, 0x3e87de0, 0xc0007af000, 0x24, 0x7a22080)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_s3_bucket.go:731 +0x524
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc0012f9dc0, 0xc001310a00, 0xc0006436a0, 0x3e87de0, 0xc0007af000, 0x100b601, 0xc000089b80, 0x10bdabc)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:231 +0x250
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc000df7d50, 0xc0013109b0, 0xc001310a00, 0xc0006436a0, 0xc000075800, 0x18, 0x9099d80)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0x9c
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc000640e80, 0xc000643240, 0xc000655350, 0x0, 0x0)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:527 +0x57
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: reflect.Value.call(0xc0001566c0, 0xc00114bac0, 0x13, 0x45329c7, 0x4, 0xc000089f18, 0x3, 0x3, 0xc00013a100, 0xc0003b3400, ...)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/goenv/versions/1.11.4/src/reflect/value.go:447 +0x454
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: reflect.Value.Call(0xc0001566c0, 0xc00114bac0, 0x13, 0xc0005a6f18, 0x3, 0x3, 0x1b, 0x0, 0xc000a4b640)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/goenv/versions/1.11.4/src/reflect/value.go:308 +0xa4
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: net/rpc.(*service).call(0xc001209ac0, 0xc000536d20, 0xc0006be2e8, 0xc0006be300, 0xc000f15500, 0xc000641740, 0x384f440, 0xc000643240, 0x16, 0x384f480, ...)
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/goenv/versions/1.11.4/src/net/rpc/server.go:384 +0x14e
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4: created by net/rpc.(*Server).ServeCodec
2019-02-01T10:45:18.801-0800 [DEBUG] plugin.terraform-provider-aws_v1.57.0_x4:  /opt/goenv/versions/1.11.4/src/net/rpc/server.go:481 +0x47e
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalWriteState
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalIf
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalWriteState
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalWriteDiff
2019/02/01 10:45:18 [TRACE] root: eval: *terraform.EvalApplyPost
2019/02/01 10:45:18 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* aws_s3_bucket.figma-alpha-api: unexpected EOF
2019/02/01 10:45:18 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* aws_s3_bucket.figma-alpha-api: unexpected EOF
2019/02/01 10:45:18 [TRACE] [walkApply] Exiting eval tree: aws_s3_bucket.figma-alpha-api
2019/02/01 10:45:18 [TRACE] dag/walk: upstream errored, not walking "provider.aws (close)"
2019/02/01 10:45:18 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2019/02/01 10:45:18 [TRACE] dag/walk: upstream errored, not walking "root"
2019-02-01T10:45:18.805-0800 [DEBUG] plugin: plugin process exited: path=/Users/lizhifan/figma/figma/config/terraform/prod/us-west-2/.terraform/plugins/darwin_amd64/terraform-provider-aws_v1.57.0_x4
2019/02/01 10:45:18 [TRACE] Preserving existing state lineage "bbb9ed33-3d8a-fd69-6079-acdd2e010423"
2019/02/01 10:45:18 [TRACE] Preserving existing state lineage "bbb9ed33-3d8a-fd69-6079-acdd2e010423"
2019/02/01 10:45:18 [TRACE] Preserving existing state lineage "bbb9ed33-3d8a-fd69-6079-acdd2e010423"
2019/02/01 10:45:18 [TRACE] Preserving existing state lineage "bbb9ed33-3d8a-fd69-6079-acdd2e010423"
2019/02/01 10:45:18 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-02-01T10:45:18.860-0800 [WARN ] plugin: error closing client during Kill: err="connection is shut down"

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
lizhifan commented 5 years ago

thanks for the quick response!

apparentlymart commented 5 years ago

Thanks for that extra information, @lizhifan! Based on that it seems that it was actually the AWS provider that crashed, rather than Terraform itself, and so I'm going to have our bot move this issue over to the AWS provider repository so the maintainers there can take a look at it.

Thanks again!

ghost commented 5 years ago

This issue has been automatically migrated to terraform-providers/terraform-provider-aws#7427 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to terraform-providers/terraform-provider-aws#7427.

ghost commented 4 years ago

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.