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

Empty Hosts Array stopping API resource apply #75

Open
stuh84 opened this issue Apr 17, 2019 · 1 comment
Open

Empty Hosts Array stopping API resource apply #75

stuh84 opened this issue Apr 17, 2019 · 1 comment

Comments

@stuh84
Copy link

stuh84 commented Apr 17, 2019

Terraform Version

Terraform v0.11.13

  • provider.aws v2.6.0
  • provider.kong v1.9.2

Not on 4.5.0 due to older version of Kong (0.10.2)

Affected Resource(s)

API Resource.

Terraform Configuration Files

resource "kong_api" "terraform-test-api" {
    name                     = "terraform-test-api"
    hosts                    =  []
    uris                     = [ "/v3/terraform-test-api" ]
    methods                  = [ "GET", "POST" ]
    upstream_url             = "http://UPSTREAM-URL"
    strip_uri                = true
    preserve_host            = false
    retries                  = 3
    upstream_connect_timeout = 60000
    upstream_send_timeout    = 60000
    upstream_read_timeout    = 60000
    https_only               = false
    http_if_terminated       = true
}

Debug Output

* kong_api.terraform-test-api: failed to create kong api: &{0xc420394da0 [] [0xc420394eb0] [0xc4203a6520 0xc4203a6530] 0xc420394ff0 0xc42009dc28 0xc42009dc29 0xc42009dcb0 0xc42009dcc0 0xc42009dcd0 0xc42009dce0 0xc42009dcf0 0xc42009dcf1} error: could not parse api creation response, error: json: cannot unmarshal string into Go struct field .hosts of type []*string {"hosts":"hosts is not an array"}

Expected Behavior

Resource created with an empty hosts value

Actual Behavior

Will not actually create it.

Steps to Reproduce

terraform apply

Important Factoids

I am guessing this is happening because Terraform does not appear to be sending the "hosts" value to the plugin, as it is viewing it as empty, or it is supplying it incorrectly.

@stuh84
Copy link
Author

stuh84 commented Apr 17, 2019

Crash log

* kong_api.terraform-test-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 string
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: 
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: goroutine 49 [running]:
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: github.com/kevholditch/terraform-provider-kong/kong.readStringArrayPtrFromResource(0xc420399260, 0xb1fbed, 0x5, 0xc4203df4e0, 0x0, 0x0)
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: 	/home/travis/gopath/src/github.com/kevholditch/terraform-provider-kong/kong/resource_reader.go:30 +0x1ed
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: github.com/kevholditch/terraform-provider-kong/kong.createKongApiRequestFromResourceData(0xc420399260, 0xc4202b49c8)
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: 	/home/travis/gopath/src/github.com/kevholditch/terraform-provider-kong/kong/resource_kong_api.go:210 +0x88
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: github.com/kevholditch/terraform-provider-kong/kong.resourceKongApiCreate(0xc420399260, 0xad2c20, 0xc420091180, 0x24, 0xf70a80)
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: 	/home/travis/gopath/src/github.com/kevholditch/terraform-provider-kong/kong/resource_kong_api.go:101 +0x2f
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: github.com/kevholditch/terraform-provider-kong/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc420371680, 0xc4203be280, 0xc4203e4500, 0xad2c20, 0xc420091180, 0xc4203ce801, 0xc4202b4b88, 0x4bbe7c)
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: 	/home/travis/gopath/src/github.com/kevholditch/terraform-provider-kong/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:193 +0x372
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: github.com/kevholditch/terraform-provider-kong/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc420398d20, 0xc4203be230, 0xc4203be280, 0xc4203e4500, 0x18, 0x18, 0xc4203e4540)
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: 	/home/travis/gopath/src/github.com/kevholditch/terraform-provider-kong/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:259 +0xa4
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: github.com/kevholditch/terraform-provider-kong/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc4203979a0, 0xc4203e40e0, 0xc4203df3c0, 0x0, 0x0)
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: 	/home/travis/gopath/src/github.com/kevholditch/terraform-provider-kong/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:488 +0x57
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: reflect.Value.call(0xc4202bc000, 0xc42000d730, 0x13, 0xb1ed5c, 0x4, 0xc4202b4f18, 0x3, 0x3, 0xc4200a1a40, 0xc4200476e8, ...)
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: 	/home/travis/.gimme/versions/go1.10.8.linux.amd64/src/reflect/value.go:447 +0x969
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: reflect.Value.Call(0xc4202bc000, 0xc42000d730, 0x13, 0xc420047718, 0x3, 0x3, 0xc420268060, 0xc400000004, 0x0)
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: 	/home/travis/.gimme/versions/go1.10.8.linux.amd64/src/reflect/value.go:308 +0xa4
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: net/rpc.(*service).call(0xc4203b65c0, 0xc4203be190, 0xc42039a958, 0xc42039a970, 0xc42015a500, 0xc420382fa0, 0x9f6860, 0xc4203e40e0, 0x16, 0x9f68a0, ...)
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: 	/home/travis/.gimme/versions/go1.10.8.linux.amd64/src/net/rpc/server.go:384 +0x14e
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: created by net/rpc.(*Server).ServeCodec
2019-04-17T15:20:19.934+0100 [DEBUG] plugin.terraform-provider-kong_v1.9.2: 	/home/travis/.gimme/versions/go1.10.8.linux.amd64/src/net/rpc/server.go:480 +0x43a
2019/04/17 15:20:19 [TRACE] root: eval: *terraform.EvalWriteState
2019/04/17 15:20:19 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2019/04/17 15:20:19 [TRACE] root: eval: *terraform.EvalIf
2019/04/17 15:20:19 [TRACE] root: eval: *terraform.EvalWriteState
2019/04/17 15:20:19 [TRACE] root: eval: *terraform.EvalWriteDiff
2019/04/17 15:20:19 [TRACE] root: eval: *terraform.EvalApplyPost
2019/04/17 15:20:19 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* kong_api.terraform-test-api: unexpected EOF
2019/04/17 15:20:19 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* kong_api.terraform-test-api: unexpected EOF
2019/04/17 15:20:19 [TRACE] [walkApply] Exiting eval tree: kong_api.terraform-test-api
2019/04/17 15:20:19 [TRACE] dag/walk: upstream errored, not walking "provider.kong (close)"
2019/04/17 15:20:19 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2019/04/17 15:20:19 [TRACE] dag/walk: upstream errored, not walking "root"
2019/04/17 15:20:19 [TRACE] Preserving existing state lineage "de29b32e-5821-c32c-abe8-b2153e0317ec"
2019-04-17T15:20:19.937+0100 [DEBUG] plugin: plugin process exited: path=/home/stuh84/.terraform.d/plugins/terraform-provider-kong_v1.9.2
2019/04/17 15:20:20 [TRACE] Preserving existing state lineage "de29b32e-5821-c32c-abe8-b2153e0317ec"
2019/04/17 15:20:20 [TRACE] Preserving existing state lineage "de29b32e-5821-c32c-abe8-b2153e0317ec"
2019/04/17 15:20:20 [TRACE] Preserving existing state lineage "de29b32e-5821-c32c-abe8-b2153e0317ec"
2019/04/17 15:20:20 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-04-17T15:20:20.125+0100 [WARN ] plugin: error closing client during Kill: err="connection is shut down"



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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant