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

resource/cloudflare_load_balancer_monitor: Fix incorrect type cast for port #213

Merged
merged 3 commits into from
Feb 24, 2019

Conversation

radeksimko
Copy link
Contributor

This is to fix a bug demonstrated by the following crashing test:

Test ended in panic.

------- Stdout: -------
=== RUN   TestAccCloudflareLoadBalancerMonitor_FullySpecified
=== PAUSE TestAccCloudflareLoadBalancerMonitor_FullySpecified
=== CONT  TestAccCloudflareLoadBalancerMonitor_FullySpecified

------- Stderr: -------
panic: interface conversion: interface {} is int, not uint16

goroutine 157 [running]:
github.com/terraform-providers/terraform-provider-cloudflare/cloudflare.resourceCloudflareLoadBalancerPoolMonitorCreate(0xc0001d3260, 0xe016e0, 0xc0001d7ad0, 0x24, 0x1669fe0)
	/opt/teamcity-agent/work/962a4ee8807683e3/src/github.com/terraform-providers/terraform-provider-cloudflare/cloudflare/resource_cloudflare_load_balancer_monitor.go:146 +0x83e
github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc0002975e0, 0xc000426910, 0xc0002a5b00, 0xe016e0, 0xc0001d7ad0, 0xc0000ca601, 0x45, 0x0)
	/opt/teamcity-agent/work/962a4ee8807683e3/src/github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:225 +0x351
github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc0002c5880, 0xc000426640, 0xc000426910, 0xc0002a5b00, 0x1, 0xc0001d1a70, 0x0)
	/opt/teamcity-agent/work/962a4ee8807683e3/src/github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0x9c
github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform.(*EvalApply).Eval(0xc0000ef8c0, 0xf771c0, 0xc0000a1040, 0x2, 0x2, 0xe043f8, 0x4)
	/opt/teamcity-agent/work/962a4ee8807683e3/src/github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform/eval_apply.go:57 +0x226
github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform.EvalRaw(0xf63c00, 0xc0000ef8c0, 0xf771c0, 0xc0000a1040, 0x0, 0x0, 0x0, 0x0)
	/opt/teamcity-agent/work/962a4ee8807683e3/src/github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform/eval.go:53 +0x156
github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform.(*EvalSequence).Eval(0xc0002a54c0, 0xf771c0, 0xc0000a1040, 0x2, 0x2, 0xe043f8, 0x4)
	/opt/teamcity-agent/work/962a4ee8807683e3/src/github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go:14 +0x9c
github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform.EvalRaw(0xf64140, 0xc0002a54c0, 0xf771c0, 0xc0000a1040, 0xce5b60, 0x15de722, 0xca9f60, 0xc0000f0c50)
	/opt/teamcity-agent/work/962a4ee8807683e3/src/github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform/eval.go:53 +0x156
github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform.Eval(0xf64140, 0xc0002a54c0, 0xf771c0, 0xc0000a1040, 0xc0002a54c0, 0xf64140, 0xc0002a54c0, 0xe4a6f8)
	/opt/teamcity-agent/work/962a4ee8807683e3/src/github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform/eval.go:34 +0x4d
github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform.(*Graph).walk.func1(0xdd3880, 0xc0000ab3d8, 0x0, 0x0)
	/opt/teamcity-agent/work/962a4ee8807683e3/src/github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/terraform/graph.go:126 +0xc45
github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc000177dc0, 0xdd3880, 0xc0000ab3d8, 0xc000471a40)
	/opt/teamcity-agent/work/962a4ee8807683e3/src/github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/dag/walk.go:387 +0x367
created by github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/dag.(*Walker).Update
	/opt/teamcity-agent/work/962a4ee8807683e3/src/github.com/terraform-providers/terraform-provider-cloudflare/vendor/github.com/hashicorp/terraform/dag/walk.go:310 +0x986

@radeksimko radeksimko added kind/bug Categorizes issue or PR as related to a bug. kind/crash Categorizes issue or PR as related to a crash caused by the provider. labels Feb 24, 2019
@ghost ghost added the size/XS label Feb 24, 2019
Copy link
Member

@jacobbednarz jacobbednarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🍻

@jacobbednarz jacobbednarz merged commit 09e96d8 into master Feb 24, 2019
@radeksimko radeksimko deleted the b-fix-data-type branch February 24, 2019 11:01
boekkooi-lengoo pushed a commit to boekkooi-lengoo/terraform-provider-cloudflare that referenced this pull request Feb 28, 2022
…e#213)

While adding support to `cf` for workers I noticed I could not
get UploadWorker to succeed. I tracked down the issue to be all
the confusing string interpolation going on here.

 - Script string is passed to UploadWorker
 - UploadWorker passes script string to makeRequest as bytes
 - makeRequest json.Marshals this byte array which mangles it

If we attempt to cast the params passed to makeRequest as a byte
array and just avoid marshalling when the params looks like bytes
then we can upload the script raw without issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/crash Categorizes issue or PR as related to a crash caused by the provider. size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants