logzio / terraform-provider-logzio

Terraform provider for logz.io alerts, endpoints and users
Apache License 2.0
19 stars 17 forks source link

Cannot create slack endpoint #45

Closed r1ckr closed 3 years ago

r1ckr commented 4 years ago

Hi, I'm new to your provider and configured the same way you have in the example.

Versions: mac OSX 10.15.5 provider version: 1.1.3 and 1.1.4

main.tf:

provider "logzio" {
  api_token = var.api_token
  base_url = "https://api-nl.logz.io"
}

resource "logzio_endpoint" "slack_some-alerts" {
  title = "slack_some-alerts"
  description = "Slack Integration for some-alerts"
  endpoint_type = "slack"
  slack {
    url = var.slack_url_some-alerts
  }
}

tfstate:

{
  "version": 4,
  "terraform_version": "0.12.26",
  "serial": 1,
  "lineage": "32ef805d-404b-5ebf-7836-1062a57c124b",
  "outputs": {},
  "resources": []
}

Error:

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

panic: unhandled endpoint type slack
2020-08-19T14:27:39.336+0100 [DEBUG] plugin.terraform-provider-logzio: 
2020-08-19T14:27:39.336+0100 [DEBUG] plugin.terraform-provider-logzio: goroutine 15 [running]:
2020-08-19T14:27:39.336+0100 [DEBUG] plugin.terraform-provider-logzio: github.com/jonboydell/logzio_terraform_provider/logzio.endpointFromResourceData(0xc00030e9a0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2020-08-19T14:27:39.336+0100 [DEBUG] plugin.terraform-provider-logzio:  /Users/jon.boydell/go/src/github.com/jonboydell/logzio_terraform_provider/logzio/resource_endpoint.go:251 +0xae3
2020-08-19T14:27:39.336+0100 [DEBUG] plugin.terraform-provider-logzio: github.com/jonboydell/logzio_terraform_provider/logzio.resourceEndpointCreate(0xc00030e9a0, 0x1b71640, 0xc000480ee0, 0x2, 0x26e5aa0)
2020-08-19T14:27:39.336+0100 [DEBUG] plugin.terraform-provider-logzio:  /Users/jon.boydell/go/src/github.com/jonboydell/logzio_terraform_provider/logzio/resource_endpoint.go:260 +0x43
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio: github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc00018ee80, 0xc0003ba640, 0xc00027a9e0, 0x1b71640, 0xc000480ee0, 0xc00027c301, 0xc0005b3428, 0x1b009a0)
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio:  /Users/jon.boydell/go/pkg/mod/github.com/hashicorp/terraform@v0.12.6/helper/schema/resource.go:287 +0x3b4
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio: github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc00018ef80, 0xc000287a58, 0xc0003ba640, 0xc00027a9e0, 0xc0005a82c8, 0xc0005b8078, 0x1b02860)
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio:  /Users/jon.boydell/go/pkg/mod/github.com/hashicorp/terraform@v0.12.6/helper/schema/provider.go:285 +0x18f
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio: github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc0000be4a0, 0x1ec80a0, 0xc0003be210, 0xc0000c4a20, 0xc0000be4a0, 0xc0003be210, 0xc0002f4bd0)
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio:  /Users/jon.boydell/go/pkg/mod/github.com/hashicorp/terraform@v0.12.6/helper/plugin/grpc_provider.go:885 +0x894
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio: github.com/hashicorp/terraform/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1c251c0, 0xc0000be4a0, 0x1ec80a0, 0xc0003be210, 0xc0003ba370, 0x0, 0x1ec80a0, 0xc0003be210, 0xc0002f8000, 0x24a)
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio:  /Users/jon.boydell/go/pkg/mod/github.com/hashicorp/terraform@v0.12.6/internal/tfplugin5/tfplugin5.pb.go:3217 +0x23e
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000001e00, 0x1ed4280, 0xc000564480, 0xc000164500, 0xc000384c30, 0x26bad20, 0x0, 0x0, 0x0)
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio:  /Users/jon.boydell/go/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:966 +0x470
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio: google.golang.org/grpc.(*Server).handleStream(0xc000001e00, 0x1ed4280, 0xc000564480, 0xc000164500, 0x0)
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio:  /Users/jon.boydell/go/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:1245 +0xd25
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00003c0a0, 0xc000001e00, 0x1ed4280, 0xc000564480, 0xc000164500)
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio:  /Users/jon.boydell/go/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:685 +0x9f
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-08-19T14:27:39.337+0100 [DEBUG] plugin.terraform-provider-logzio:  /Users/jon.boydell/go/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:683 +0xa1
2020/08/19 14:27:39 [DEBUG] logzio_endpoint.some-alerts: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
2020/08/19 14:27:39 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/08/19 14:27:39 [TRACE] EvalMaybeTainted: logzio_endpoint.some-alerts encountered an error during creation, so it is now marked as tainted
2020/08/19 14:27:39 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/08/19 14:27:39 [TRACE] EvalWriteState: removing state object for logzio_endpoint.some-alerts
2020/08/19 14:27:39 [TRACE] <root>: eval: *terraform.EvalApplyProvisioners
2020/08/19 14:27:39 [TRACE] EvalApplyProvisioners: logzio_endpoint.some-alerts has no state, so skipping provisioners
2020/08/19 14:27:39 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/08/19 14:27:39 [TRACE] EvalMaybeTainted: logzio_endpoint.some-alerts encountered an error during creation, so it is now marked as tainted
2020/08/19 14:27:39 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/08/19 14:27:39 [TRACE] EvalWriteState: removing state object for logzio_endpoint.some-alerts
2020/08/19 14:27:39 [TRACE] <root>: eval: *terraform.EvalIf
2020/08/19 14:27:39 [TRACE] <root>: eval: *terraform.EvalIf
2020/08/19 14:27:39 [TRACE] <root>: eval: *terraform.EvalWriteDiff
2020/08/19 14:27:39 [TRACE] <root>: eval: *terraform.EvalApplyPost
2020-08-19T14:27:39.338+0100 [DEBUG] plugin: plugin process exited: path=/Users/rpablo/.terraform.d/plugins/terraform-provider-logzio pid=61927 error="exit status 2"
2020/08/19 14:27:39 [ERROR] <root>: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/08/19 14:27:39 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/08/19 14:27:39 [TRACE] [walkApply] Exiting eval tree: logzio_endpoint.some-alerts
2020/08/19 14:27:39 [TRACE] vertex "logzio_endpoint.some-alerts": visit complete
2020/08/19 14:27:39 [TRACE] dag/walk: upstream of "provider.logzio (close)" errored, so skipping
2020/08/19 14:27:39 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/08/19 14:27:39 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/08/19 14:27:39 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old
2020/08/19 14:27:39 [TRACE] statemgr.Filesystem: no state changes since last snapshot
2020/08/19 14:27:39 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2020/08/19 14:27:39 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2020/08/19 14:27:39 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2020-08-19T14:27:39.353+0100 [DEBUG] plugin: plugin exited
yyyogev commented 4 years ago

Hi @r1ckr the endpoint type should be Slack with capital S, we will fix the readme soon.

r1ckr commented 4 years ago

Would be possible to ignore the casing on those type of parameters? That will be way less error prone

yyyogev commented 4 years ago

That's a great idea @r1ckr , we will add it to our roadmap. You are more than welcome to open a PR for that as well

r1ckr commented 4 years ago

Cheers @yyyogev ! Where would that PR be needed? in the terraform client or the provider?

yyyogev commented 4 years ago

At the provider, in the resource_endoint

yyyogev commented 3 years ago

Done at https://github.com/logzio/terraform_provider_logzio/pull/50