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

Issues creating tables: panic: assignment to entry in nil map #8214

Closed
textbook opened this issue Apr 5, 2019 · 5 comments · Fixed by #8226
Closed

Issues creating tables: panic: assignment to entry in nil map #8214

textbook opened this issue Apr 5, 2019 · 5 comments · Fixed by #8226
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. provider Pertains to the provider itself, rather than any interaction with AWS. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement.
Milestone

Comments

@textbook
Copy link

textbook commented Apr 5, 2019

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 Version

2019/04/05 12:38:38 [INFO] Terraform version: 0.11.8  7a5c1d221ac209bbac66947c369815cd9ca70ed5
2019/04/05 12:38:38 [INFO] Go runtime version: go1.10.1

(Also tried with 0.11.13, same behaviour)

Affected Resource(s)

  • aws_v2.5.0, aws_dynamodb_table

Terraform Configuration Files

provider "aws" {
  region = "eu-west-2"
  version = "~> 2.5.0"

  endpoints {
    dynamodb = "http://dynamo:8000"
  }
}

resource "aws_dynamodb_table" "logins-dynamodb-table" {
  name           = "logins"
  hash_key       = "username"
  read_capacity  = "1"
  write_capacity = "1"

  attribute {
    name = "username"
    type = "S"
  }
}

Debug Output

https://gist.github.com/textbook/74ae81de86d1a4d9f19a4c89ff637d2c

Panic Output

2019-04-05T12:38:39.071Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: 2019/04/05 12:38:39 [INFO] No assume_role block read from configuration
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: panic: assignment to entry in nil map
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: 
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: goroutine 34 [running]:
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.providerConfigure(0xc000954770, 0x0, 0xc00063a6e0, 0xc000954770, 0x0)
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/provider.go:1010 +0xda9
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Configure(0xc0009544d0, 0xc00094b470, 0x7f249d3f6000, 0x0)
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:264 +0xcd
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Configure(0xc000129ee0, 0xc00094b470, 0xc000ae81f8, 0x0, 0x0)
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:517 +0x3e
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: reflect.Value.call(0xc00011f1a0, 0xc000ae8008, 0x13, 0x3cd8565, 0x4, 0xc0009faf18, 0x3, 0x3, 0xc000127ac0, 0x413257, ...)
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: 	/opt/goenv/versions/1.11.5/src/reflect/value.go:447 +0x454
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: reflect.Value.Call(0xc00011f1a0, 0xc000ae8008, 0x13, 0xc00038d718, 0x3, 0x3, 0x12a05f200, 0xc00038d710, 0xc00038d7b8)
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: 	/opt/goenv/versions/1.11.5/src/reflect/value.go:308 +0xa4
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: net/rpc.(*service).call(0xc00007a0c0, 0xc000ab8000, 0xc00031c060, 0xc00031c070, 0xc00010a680, 0xc00063a020, 0x3a53d60, 0xc00094b470, 0x16, 0x2f40820, ...)
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: 	/opt/goenv/versions/1.11.5/src/net/rpc/server.go:384 +0x14e
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: created by net/rpc.(*Server).ServeCodec
2019-04-05T12:38:39.082Z [DEBUG] plugin.terraform-provider-aws_v2.5.0_x4: 	/opt/goenv/versions/1.11.5/src/net/rpc/server.go:481 +0x47e

Expected Behavior

Table gets created as required (and as works fine in 2.4.0).

Actual Behavior

Steps to Reproduce

  1. terraform apply -auto-approve

Important Factoids

Running this against the amazon/dynamodb-local container image in a network defined by Docker Compose.

References

@ghost ghost added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. labels Apr 5, 2019
@dreamlibrarian
Copy link

Amplifying this: any endpoint customization blows up under 2.5.0, because we're not initializing the new Endpoints map before using it.

Probably just needs a make(map[string]string) in the Config initialization block?

https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/provider.go#L1010

@bflad bflad added provider Pertains to the provider itself, rather than any interaction with AWS. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. labels Apr 6, 2019
@bflad bflad added this to the v2.6.0 milestone Apr 6, 2019
bflad added a commit that referenced this issue Apr 6, 2019
Reference: #8214

Output from acceptance testing before code change:

```
=== CONT  TestAccAWSProvider_Endpoints
panic: assignment to entry in nil map

goroutine 614 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.providerConfigure(0xc000c2fd50, 0x0, 0xc00098e300, 0xc000c2fd50, 0x0)
	/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/provider.go:1011 +0xde1
github.com/hashicorp/terraform/helper/schema.(*Provider).Configure(0xc000af7650, 0xc0006de000, 0xc, 0x653dec0)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/helper/schema/provider.go:264 +0xcd
github.com/hashicorp/terraform/terraform.(*BuiltinEvalContext).ConfigureProvider(0xc000a31860, 0xc00142c880, 0xc, 0xc0006de000, 0x0, 0x31)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/terraform/eval_context_builtin.go:136 +0x14a
github.com/hashicorp/terraform/terraform.(*EvalConfigProvider).Eval(0xc0009a4b40, 0x6543da0, 0xc000a31860, 0x2, 0x2, 0x59a0521, 0x4)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/terraform/eval_provider.go:48 +0x53
github.com/hashicorp/terraform/terraform.EvalRaw(0x645b160, 0xc0009a4b40, 0x6543da0, 0xc000a31860, 0xc000114000, 0x2, 0xc000660150, 0x2b)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/terraform/eval.go:53 +0x11a
github.com/hashicorp/terraform/terraform.(*EvalSequence).Eval(0xc0009a4b60, 0x6543da0, 0xc000a31860, 0x2, 0x2, 0x59a0521, 0x4)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/terraform/eval_sequence.go:14 +0x9c
github.com/hashicorp/terraform/terraform.EvalRaw(0x645b560, 0xc0009a4b60, 0x6543da0, 0xc000a31860, 0x2b, 0x0, 0x0, 0x2b)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/terraform/eval.go:53 +0x11a
github.com/hashicorp/terraform/terraform.(*EvalOpFilter).Eval(0xc00142f560, 0x6543da0, 0xc000a31860, 0x2, 0x2, 0x59a0521, 0x4)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/terraform/eval_filter_operation.go:37 +0x4c
github.com/hashicorp/terraform/terraform.EvalRaw(0x645b440, 0xc00142f560, 0x6543da0, 0xc000a31860, 0x0, 0x0, 0x0, 0x0)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/terraform/eval.go:53 +0x11a
github.com/hashicorp/terraform/terraform.(*EvalSequence).Eval(0xc0009a4b80, 0x6543da0, 0xc000a31860, 0x2, 0x2, 0x59a0521, 0x4)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/terraform/eval_sequence.go:14 +0x9c
github.com/hashicorp/terraform/terraform.EvalRaw(0x645b560, 0xc0009a4b80, 0x6543da0, 0xc000a31860, 0x50696e0, 0x9b05605, 0x4c8c7a0, 0xc00142b700)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/terraform/eval.go:53 +0x11a
github.com/hashicorp/terraform/terraform.Eval(0x645b560, 0xc0009a4b80, 0x6543da0, 0xc000a31860, 0xc0009a4b80, 0x645b560, 0xc0009a4b80, 0xc000075db0)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/terraform/eval.go:34 +0x4d
github.com/hashicorp/terraform/terraform.(*Graph).walk.func1(0x571f240, 0xc00143e098, 0x0, 0x0)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/terraform/graph.go:126 +0xbc2
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc001431810, 0x571f240, 0xc00143e098, 0xc00063c180)
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/dag/walk.go:387 +0x33b
created by github.com/hashicorp/terraform/dag.(*Walker).Update
	/Users/bflad/go/pkg/mod/github.com/hashicorp/terraform@v0.11.14-0.20190329073242-44702fa6c163/dag/walk.go:310 +0xa4f
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	3.940s
```

Output from acceptance testing after code change:

```
--- PASS: TestAccAWSProvider_Endpoints (1.68s)
```
@bflad
Copy link
Contributor

bflad commented Apr 6, 2019

Hi Folks 👋 Apologies for the unexpected behavior with the last release. I have submitted a fix with a covering test here, which we will release early next week: #8226

@bflad
Copy link
Contributor

bflad commented Apr 10, 2019

The fix for this has been merged and will release with version 2.6.0 of the Terraform AWS Provider later today 👍

@bflad
Copy link
Contributor

bflad commented Apr 11, 2019

The fix for this has been released in version 2.6.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Mar 30, 2020

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. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. provider Pertains to the provider itself, rather than any interaction with AWS. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants