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.42k stars 9.51k forks source link

Terraform Crash with null used conditionally in a list #22218

Closed s16tom closed 4 years ago

s16tom commented 5 years ago

Terraform Version

Terraform v0.12.3
+ provider.aws v2.21.0
+ provider.null v2.1.2
+ provider.template v2.1.2

Terraform Configuration Files

"aws_lambda_function" "lambda" {

...
layers        = ["${var.LAYERS_REQUIRED ? aws_lambda_layer_version.lambda-layers.0.arn : null}"]
...

}

Crash Output

Crash log seems to contain sensitive data - not shared.

Expected Behavior

Rightly or wrongly I was expecting the layers property to be set to ["layers_arn"] if the LAYERS_REQUIRED var was set to true or [] if it was false. If the null value was used incorrectly I would expect Terraform to tell me to RTFM.

Actual Behavior

Setting the null as above resulting in a Terraform crash. Change null to "" works as expected.

teamterraform commented 5 years ago

Hello @s16tom with terraform 0.12 the canonical usage for this situation would be to write it as:

layers = var.LAYERS_REQUIRED ? aws_lambda_layer_version.lambda-layers.0.arn : null

It's possible the string interpolation is causing the crash somewhere along the way. Unfortunately without some kind of output there is not much we can debug. I understand it might be difficult to scrub the entire log, do you think you could isolate the logs around something that contains panic:? and the stacktrace after that? Ensuring those lines have been scrubbed of sensitive info

nogweii commented 5 years ago

I believe I am getting a similar crash, but with a different AWS resource:

# create an S3 bucket to host the static assets
resource "aws_s3_bucket" "static_files" {
  bucket = "${terraform.workspace}-assets.${var.domain}"
  acl    = "public-read"
  cors_rule {
    allowed_headers = []
    allowed_methods = ["GET"]
    allowed_origins = [
      "https://${terraform.workspace}.${var.domain}",
      "https://${terraform.workspace}-assets.${var.domain}",
      terraform.workspace == "dev" ? "http://localhost:8000" : null,
    ]
    expose_headers  = [
      "Etag",
      "Content-Length",
      "Expect-CT",
      "x-amz-request-id",
      "x-amz-id-2",
    ]
    max_age_seconds = 3000
  }
}

When I switch to a different workspace than dev, I get this crash:

panic: reflect: call of reflect.Value.Type on zero Value
2019-08-01T11:16:34.716-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: 
2019-08-01T11:16:34.716-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: goroutine 100 [running]:
2019-08-01T11:16:34.716-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: reflect.Value.Type(0x0, 0x0, 0x0, 0x38, 0x0)
2019-08-01T11:16:34.716-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/goenv/versions/1.12.6/src/reflect/value.go:1813 +0x169
2019-08-01T11:16:34.716-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validatePrimitive(0xc00063d980, 0xc000cf6ac0, 0x1d, 0x0, 0x0, 0xc0005f5000, 0xc0007bb200, 0x3, 0x3cd2a00, 0xc0007aa7e0, ...)
2019-08-01T11:16:34.716-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1694 +0xc8
2019-08-01T11:16:34.716-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validateType(0xc00063d980, 0xc000cf6ac0, 0x1d, 0x0, 0x0, 0xc0005f5000, 0xc0007bb200, 0x0, 0x0, 0x0, ...)
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1779 +0x56f
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validateList(0xc00063d980, 0xc000cf6a60, 0x1b, 0x3cd2a00, 0xc0007aa7e0, 0xc0005f5400, 0xc0007bb200, 0x2, 0x416b120, 0xc0007bb2f0, ...)
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1495 +0x86c
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validateType(0xc00063d980, 0xc000cf6a60, 0x1b, 0x3cd2a00, 0xc0007aa7e0, 0xc0005f5400, 0xc0007bb200, 0x461dca, 0x91d06b0, 0xc000788b00, ...)
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1775 +0x9e
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validate(0xc00063d980, 0xc000cf6a60, 0x1b, 0xc0005f5400, 0xc0007bb200, 0xc000cf6a60, 0x1b, 0x0, 0x0, 0x0, ...)
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1382 +0x213
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validateObject(0xc00063d980, 0xc000cf8fd5, 0xb, 0xc00063d350, 0xc0007bb200, 0xc000cf8f01, 0xb, 0x4088cc, 0xc00001e000, 0x4357340, ...)
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1661 +0x1c6
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validateList(0xc00063d980, 0x4b37abf, 0x9, 0x3cd2a00, 0xc0007aa820, 0xc000619600, 0xc0007bb200, 0x0, 0x0, 0x8000101, ...)
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1493 +0x8fc
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validateType(0xc00063d980, 0x4b37abf, 0x9, 0x3cd2a00, 0xc0007aa820, 0xc000619600, 0xc0007bb200, 0x0, 0x0, 0x0, ...)
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1775 +0x9e
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validate(0xc00063d980, 0x4b37abf, 0x9, 0xc000619600, 0xc0007bb200, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2019-08-01T11:16:34.717-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1382 +0x213
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validateObject(0xc00063d980, 0x0, 0x0, 0xc00063d980, 0xc0007bb200, 0x4b42e43, 0xc000cf8c00, 0xd, 0xc000426301, 0xfe00000000000000, ...)
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1661 +0x1c6
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.Validate(...)
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:677
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Validate(0xc0005f2f00, 0xc0007bb200, 0xc000cf8c00, 0xd, 0xc0006c92f0, 0x1, 0x40, 0x0)
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:368 +0x5e
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).ValidateResource(0xc0006a7800, 0xc000cf8c00, 0xd, 0xc0007bb200, 0xc0007a6410, 0xc0007bb200, 0xc0000b2e80, 0x416b120, 0xc0007bb1a0, 0x0)
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:242 +0x1d8
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ValidateResourceTypeConfig(0xc0000b2488, 0x53ca7e0, 0xc00079fb30, 0xc000582f80, 0xc0000b2488, 0xc00079fb30, 0xc000761bd0)
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go:205 +0x1d9
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/internal/tfplugin5._Provider_ValidateResourceTypeConfig_Handler(0x4a24280, 0xc0000b2488, 0x53ca7e0, 0xc00079fb30, 0xc000cfac30, 0x0, 0x53ca7e0, 0xc00079fb30, 0xc0007a8840, 0x2b6)
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go:3109 +0x23e
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc.(*Server).processUnaryRPC(0xc0005a2900, 0x53ebf80, 0xc0005a3380, 0xc00052a600, 0xc0006ba720, 0x91db970, 0x0, 0x0, 0x0)
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:966 +0x470
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc.(*Server).handleStream(0xc0005a2900, 0x53ebf80, 0xc0005a3380, 0xc00052a600, 0x0)
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:1245 +0xd25
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0001543d0, 0xc0005a2900, 0x53ebf80, 0xc0005a3380, 0xc00052a600)
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:685 +0x9f
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: created by github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc.(*Server).serveStreams.func1
2019-08-01T11:16:34.718-0700 [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:683 +0xa1
2019-08-01T11:16:34.723-0700 [DEBUG] plugin: plugin process exited: path=/home/.../code/videos/infrastructure/.terraform/plugins/linux_amd64/terraform-provider-aws_v2.19.0_x4 pid=22469 error="exit status 2"
2019/08/01 11:16:34 [ERROR] <root>: eval: *terraform.EvalDiff, err: rpc error: code = Unavailable desc = transport is closing
2019/08/01 11:16:34 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2019/08/01 11:16:34 [TRACE] [walkPlan] Exiting eval tree: aws_s3_bucket.static_files
2019/08/01 11:16:34 [TRACE] vertex "aws_s3_bucket.static_files": visit complete
2019/08/01 11:16:34 [TRACE] vertex "aws_s3_bucket.static_files": dynamic subgraph encountered errors
2019/08/01 11:16:34 [TRACE] vertex "aws_s3_bucket.static_files": visit complete
2019/08/01 11:16:34 [TRACE] dag/walk: upstream of "provider.aws (close)" errored, so skipping
2019/08/01 11:16:34 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2019/08/01 11:16:34 [TRACE] dag/walk: upstream of "root" errored, so skipping
2019/08/01 11:16:34 [INFO] backend/local: plan operation completed
2019-08-01T11:16:34.724-0700 [DEBUG] plugin: plugin exited
!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.
When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.
[1]: https://github.com/hashicorp/terraform/issues
!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

The generated crash.log is also attached.

bflad commented 5 years ago

We've received another similar crash report downstream in the Terraform AWS Provider: https://github.com/terraform-providers/terraform-provider-aws/issues/9910

Confirming with the reporter if upgrading to the latest Terraform and Terraform AWS Provider fixes the issue.

Terraform Versions: v0.12.3 and Terraform AWS Provider v2.22.0

Stacktrace:

2019-08-29T15:20:00.741+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: panic: reflect: call of reflect.Value.Type on zero Value
2019-08-29T15:20:00.741+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: 
2019-08-29T15:20:00.741+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: goroutine 762 [running]:
2019-08-29T15:20:00.741+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: reflect.Value.Type(0x0, 0x0, 0x0, 0x38, 0x200)
2019-08-29T15:20:00.741+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4:  /opt/goenv/versions/1.12.6/src/reflect/value.go:1813 +0x169
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validatePrimitive(0xc0005beb40, 0xc0008e0160, 0x9, 0x0, 0x0, 0xc0005de300, 0xc0006c3230, 0x1, 0x492c720, 0xc000ac6420, ...)
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1694 +0xc8
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validateType(0xc0005beb40, 0xc0008e0160, 0x9, 0x0, 0x0, 0xc0005de300, 0xc0006c3230, 0x49a24a0, 0x49a24a0, 0x100f701, ...)
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1779 +0x56f
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validateList(0xc0005beb40, 0x579f000, 0x7, 0x492c720, 0xc000ac6420, 0xc0005df100, 0xc0006c3230, 0xc0006c3260, 0x0, 0x0, ...)
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1495 +0x86c
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validateType(0xc0005beb40, 0x579f000, 0x7, 0x492c720, 0xc000ac6420, 0xc0005df100, 0xc0006c3230, 0x0, 0x0, 0x0, ...)
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1775 +0x9e
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validate(0xc0005beb40, 0x579f000, 0x7, 0xc0005df100, 0xc0006c3230, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1382 +0x213
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.validateObject(0xc0005beb40, 0x0, 0x0, 0xc0005beb40, 0xc0006c3230, 0x57c2668, 0xc0008060c0, 0x12, 0xc000408401, 0xc000000000000000, ...)
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:1661 +0x1c6
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.Validate(...)
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:677
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Validate(0xc0005c3380, 0xc0006c3230, 0xc0008060c0, 0x12, 0xc000664798, 0x1, 0x40, 0x0)
2019-08-29T15:20:00.742+0800 [DEBUG] plugin.terraform-provider-aws_v2.22.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:357 +0x5e
bflad commented 5 years ago

This was likely addressed by #22236 (tagged with v0.12.6) and at least for the Terraform AWS Provider, fixed in version 2.23.0 or later which contained that update.

danieldreier commented 4 years ago

@s16tom or @nogweii are you able to confirm whether the fix @bflad pointed to resolved this issue? Can you reproduce it in 0.13.0 beta 1?

apparentlymart commented 4 years ago

Hi all,

In the meantime since this was originally discussed, the code that was raising this crash has moved into the separate Terraform SDK repository as part of splitting that out from the Terraform Core functionality so it can have an independent development/release cycle.

We've not heard of any similar reports since #22236 was merged and included in providers, so I'm going to close this on the assumption that the change in that PR was the solution to this issue. If you see an issue similar to this (a panic whose stack trace shows it being raised in schema.schemaMap.validatePrimitive), please open an issue in the SDK repository because that is now where such an issue would need to be addressed. Thanks!

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.