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

ns1: Fix incorrect schema for 'ns1_user.notify' #12721

Merged
merged 2 commits into from
Mar 15, 2017
Merged

Conversation

radeksimko
Copy link
Member

This was uncovered as part of tightening validation in #12638

Prior to this patch user could run into a crash just by specifying notify:

resource "ns1_team" "t" {
  name = "any test team"
}

resource "ns1_user" "u" {
  name = "terraform acc test user"
  username = "test_user_any"
  email = "any_test_ns1@hashicorp.com"
  teams = ["${ns1_team.t.id}"]
  notify {
  	billing = true
  }
}
panic: interface conversion: interface {} is string, not bool

goroutine 132 [running]:
github.com/hashicorp/terraform/builtin/providers/ns1.resourceDataToUser(0xc4203c2460, 0xc4200543f0, 0xc420020600, 0xc4203db490)
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/builtin/providers/ns1/resource_user.go:83 +0x448
github.com/hashicorp/terraform/builtin/providers/ns1.UserCreate(0xc4200543f0, 0x1588de0, 0xc4203c2000, 0x0, 0x0)
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/builtin/providers/ns1/resource_user.go:93 +0xbf
github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc42001db00, 0xc4204a4c30, 0xc4204902c0, 0x1588de0, 0xc4203c2000, 0xc420400901, 0x2a, 0x0)
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/helper/schema/resource.go:186 +0x48d
github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc420180e00, 0xc4204a4460, 0xc4204a4c30, 0xc4204902c0, 0x1, 0xd05b3877, 0x0)
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/helper/schema/provider.go:242 +0x9b
github.com/hashicorp/terraform/terraform.(*EvalApply).Eval(0xc420348800, 0x18b5a00, 0xc4200a4c40, 0x2, 0x2, 0x1616cdf, 0x4)
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/terraform/eval_apply.go:57 +0x232
github.com/hashicorp/terraform/terraform.EvalRaw(0x18aa740, 0xc420348800, 0x18b5a00, 0xc4200a4c40, 0x0, 0x0, 0x0, 0x0)
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/terraform/eval.go:53 +0x175
github.com/hashicorp/terraform/terraform.(*EvalSequence).Eval(0xc4204a3c20, 0x18b5a00, 0xc4200a4c40, 0x2, 0x2, 0x1616cdf, 0x4)
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/terraform/eval_sequence.go:14 +0xc1
github.com/hashicorp/terraform/terraform.EvalRaw(0x18ab080, 0xc4204a3c20, 0x18b5a00, 0xc4200a4c40, 0x1567500, 0xc4204a1b4a, 0x154fac0, 0xc4204a1bf0)
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/terraform/eval.go:53 +0x175
github.com/hashicorp/terraform/terraform.Eval(0x18ab080, 0xc4204a3c20, 0x18b5a00, 0xc4200a4c40, 0xc4204a3c20, 0x18ab080, 0xc4204a3c20, 0xc420035be0)
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/terraform/eval.go:34 +0x4d
github.com/hashicorp/terraform/terraform.(*Graph).walk.func1(0x15f5920, 0xc42000fca8, 0x0, 0x0)
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/terraform/graph.go:126 +0xd4d
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc420379880, 0x15f5920, 0xc42000fca8, 0xc420399380)
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/dag/walk.go:387 +0x392
created by github.com/hashicorp/terraform/dag.(*Walker).Update
	/Users/radeksimko/gopath/src/github.com/hashicorp/terraform/dag/walk.go:310 +0x9ca

The crash is just hidden behind an error due to the mentioned tight validation.

Test plan

make testacc TEST=./builtin/providers/ns1 TESTARGS='-run=TestAccUser'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/15 13:42:15 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/ns1 -v -run=TestAccUser -timeout 120m
=== RUN   TestAccUser_basic
--- PASS: TestAccUser_basic (14.00s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/ns1	14.025s

@stack72
Copy link
Contributor

stack72 commented Mar 15, 2017

LGTM! Nice work on catching that panic

@radeksimko radeksimko merged commit fff0b69 into master Mar 15, 2017
@radeksimko radeksimko deleted the b-ns1-fix-schema branch March 15, 2017 14:39
radeksimko added a commit that referenced this pull request Mar 15, 2017
* ns1: Add acceptance test for ns1_user

* ns1: Fix incorrect schema for 'notify'
@ghost
Copy link

ghost commented Apr 15, 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 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 Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants