splunk-terraform / terraform-provider-signalfx

Terraform SignalFx provider
https://www.terraform.io/docs/providers/signalfx/
Mozilla Public License 2.0
33 stars 72 forks source link

[CRASH] creating resources crashes terraform #191

Closed ngortheone closed 4 years ago

ngortheone commented 4 years ago

Creation of signalfx resources does not work.

Using example: https://www.terraform.io/docs/providers/signalfx/r/org_token.html

I was trying to create an org token, but terraform errors out and often crashes. The org token is created nevertheless.

Details"

$ terraform version                                                                                                                                                                
Terraform v0.12.24
+ provider.signalfx v4.19.1
provider "signalfx" {
  api_url = "https://api.us1.signalfx.com"
}
resource "signalfx_org_token" "myteamkey0" {
  name = "my-test-2"
}

First apply:

Terraform will perform the following actions:

  # signalfx_org_token.myteamkey0 will be created
  + resource "signalfx_org_token" "myteamkey0" {
      + disabled = false
      + id       = (known after apply)
      + name     = "my-test-2"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

signalfx_org_token.myteamkey0: Creating...

Error: rpc error: code = Unavailable desc = transport is closing

$

Or sometimes terraform errors out and crashes

...

Error: rpc error: code = Unavailable desc = transport is closing

panic: set item just set doesn't exist
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: goroutine 37 [running]:
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*MapFieldWriter).setSet(0xc0005f62a0, 0xc0003bc250, 0x1, 0x1, 0xec0240, 0xc00000c7e0, 0xc00047a500, 0xc0003bc250, 0xc000453b90)
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_writer_map.go:328 +0xc06
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*MapFieldWriter).set(0xc0005f62a0, 0xc0003bc250, 0x1, 0x1, 0xec0240, 0xc00000c640, 0x1, 0x4eb1e2)
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_writer_map.go:107 +0x28b
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*MapFieldWriter).WriteField(0xc0005f62a0, 0xc0003bc250, 0x1, 0x1, 0xec0240, 0xc00000c640, 0x0, 0x0)
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_writer_map.go:89 +0x504
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ResourceData).Set(0xc00039a380, 0x109e0d6, 0x14, 0xec0240, 0xc00000c640, 0x0, 0x0)
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_data.go:199 +0x1ed
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: github.com/terraform-providers/terraform-provider-signalfx/signalfx.orgTokenAPIToTF(0xc00039a380, 0xc0002060a0, 0x19, 0x0)
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/signalfx/resource_signalfx_org_token.go:288 +0x6a1
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: github.com/terraform-providers/terraform-provider-signalfx/signalfx.orgTokenCreate(0xc00039a380, 0xea3000, 0xc0003be4c0, 0x2, 0x1b62180)
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/signalfx/resource_signalfx_org_token.go:227 +0x18d
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc000453cb0, 0xc000456e10, 0xc00059d980, 0xea3000, 0xc0003be4c0, 0xc000406801, 0xc0003e5340, 0xf27480)
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go:310 +0x3b4
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc000108980, 0xc0000ada60, 0xc000456e10, 0xc00059d980, 0xc0003f7708, 0xc00000ea00, 0xf29160)
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go:294 +0x18f
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00000ec88, 0x131f7c0, 0xc0003f5200, 0xc000161a40, 0xc00000ec88, 0xc0003f5200, 0xc000517bc8)
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:885 +0x8b5
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1051f60, 0xc00000ec88, 0x131f7c0, 0xc0003f5200, 0xc00012ce40, 0x0, 0x131f7c0, 0xc0003f5200, 0xc0000b29a0, 0x14f)
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go:3305 +0x23e
2020-04-21T14:25:45.212-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000001b00, 0x132b3a0, 0xc000536a80, 0xc00058e100, 0xc00004bf20, 0x1b36480, 0x0, 0x0, 0x0)
2020-04-21T14:25:45.213-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/google.golang.org/grpc/server.go:1024 +0x4d2
2020-04-21T14:25:45.213-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: google.golang.org/grpc.(*Server).handleStream(0xc000001b00, 0x132b3a0, 0xc000536a80, 0xc00058e100, 0x0)
2020-04-21T14:25:45.213-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/google.golang.org/grpc/server.go:1313 +0xda6
2020-04-21T14:25:45.213-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000360240, 0xc000001b00, 0x132b3a0, 0xc000536a80, 0xc00058e100)
2020-04-21T14:25:45.213-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/google.golang.org/grpc/server.go:722 +0x9f
2020-04-21T14:25:45.213-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-04-21T14:25:45.213-0700 [DEBUG] plugin.terraform-provider-signalfx_v4.19.1_x4:     /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-signalfx/vendor/google.golang.org/grpc/server.go:720 +0xa1
2020-04-21T14:25:45.214-0700 [DEBUG] plugin: plugin process exited: path=/home/ngor/dev/github.ol.epicgames.net/terraform/substrate-infrastructure/accounts/dead-dev/.terraform/plugins/linux_amd64/terraform-provider-signalfx_v4.19.1_x4 pid=1178692 error="exit status 2"
2020/04/21 14:25:45 [DEBUG] signalfx_org_token.myteamkey0: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
2020/04/21 14:25:45 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/04/21 14:25:45 [TRACE] EvalMaybeTainted: signalfx_org_token.myteamkey0 encountered an error during creation, so it is now marked as tainted
2020/04/21 14:25:45 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/04/21 14:25:45 [TRACE] EvalWriteState: removing state object for signalfx_org_token.myteamkey0
2020/04/21 14:25:45 [TRACE] <root>: eval: *terraform.EvalApplyProvisioners
2020/04/21 14:25:45 [TRACE] EvalApplyProvisioners: signalfx_org_token.myteamkey0 has no state, so skipping provisioners
2020/04/21 14:25:45 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/04/21 14:25:45 [TRACE] EvalMaybeTainted: signalfx_org_token.myteamkey0 encountered an error during creation, so it is now marked as tainted
2020/04/21 14:25:45 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/04/21 14:25:45 [TRACE] EvalWriteState: removing state object for signalfx_org_token.myteamkey0
2020/04/21 14:25:45 [TRACE] <root>: eval: *terraform.EvalIf
2020/04/21 14:25:45 [TRACE] <root>: eval: *terraform.EvalIf
2020/04/21 14:25:45 [TRACE] <root>: eval: *terraform.EvalWriteDiff
2020/04/21 14:25:45 [TRACE] <root>: eval: *terraform.EvalApplyPost
2020/04/21 14:25:45 [ERROR] <root>: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/04/21 14:25:45 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/04/21 14:25:45 [TRACE] [walkApply] Exiting eval tree: signalfx_org_token.myteamkey0
2020/04/21 14:25:45 [TRACE] vertex "signalfx_org_token.myteamkey0": visit complete
2020/04/21 14:25:45 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/04/21 14:25:45 [TRACE] dag/walk: upstream of "provider.signalfx (close)" errored, so skipping
2020/04/21 14:25:45 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020-04-21T14:25:45.224-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.

SECURITY WARNING: the "crash.log" file that was created may contain
sensitive information that must be redacted before it is safe to share
on the issue tracker.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Subsequent application also fails:

Terraform will perform the following actions:

  # signalfx_org_token.myteamkey0 will be created
  + resource "signalfx_org_token" "myteamkey0" {
      + disabled = false
      + id       = (known after apply)
      + name     = "my-test-2"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

signalfx_org_token.myteamkey0: Creating...

Error: Bad status 406: {
  "code" : 406,
  "message" : "A token with the same name already exists!"
}
cory-signalfx commented 4 years ago

Thanks for reporting @ngortheone, I'm on it!

cory-signalfx commented 4 years ago

Hey there @ngortheone, sorry you bumped into this. This was fixed in #192 and I've requested a new release which should land soonish. You can try the upgrade with terraform init -upgrade and the newest should download. The version you will want is 4.19.2.

Because the key was created you have two options for how to proceed:

The former is probably best, but the latter will work if you've already started using the key and it's more work to delete it.

ngortheone commented 4 years ago

Thanks for prompt reply @cory-signalfx, I will test this today!

cory-signalfx commented 4 years ago

No problem! I got word that this release should now be available, so you should be able to upgrade, etc.

ngortheone commented 4 years ago

I confirm that the fix works. Thanks so much!

cory-signalfx commented 4 years ago

😻