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

Support python data source #16

Open
z0rc opened this issue Nov 29, 2021 · 1 comment
Open

Support python data source #16

z0rc opened this issue Nov 29, 2021 · 1 comment

Comments

@z0rc
Copy link

z0rc commented Nov 29, 2021

Python data source allows to set two options:

  • Modules To Import Prior To Running The Script
  • AdditionalModulesPaths

redash_data_source resource allows to create python Data Source, but provider's resource schema doesn't allow to set additional options.

FYI python data source can be enabled by setting env var REDASH_ADDITIONAL_QUERY_RUNNERS=redash.query_runner.python for redash server.

@z0rc z0rc changed the title Support python's data_source options Support python's data source options Nov 29, 2021
@z0rc z0rc changed the title Support python's data source options Support python data source Nov 29, 2021
@z0rc
Copy link
Author

z0rc commented Nov 29, 2021

Actually it isn't possible to create python data source with provider.

resource "redash_data_source" "python" {
  name = "Python"
  type = "python"

  options {}
}

Passes terraform plan but crashes on terraform apply.

redash_data_source.python: Creating...
╷
│ Error: Plugin did not respond
│
│   with redash_data_source.python,
│   on python.tf line 1, in resource "redash_data_source" "python":
│    1: resource "redash_data_source" "python" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
Releasing state lock. This may take a few moments...

Stack trace from the terraform-provider-redash_v0.6.0 plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 26 [running]:
main.resourceRedashDataSourceCreate(0x1c69eb8, 0xc000280f00, 0xc00010f780, 0x1ad01c0, 0xc0000c9218, 0xc0004bfb90, 0x12eeeea, 0xc00062ede0)
	github.com/snowplow-devops/terraform-provider-redash/terraform-provider-redash/resource_data_source.go:461 +0x72d
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0002ca0e0, 0x1c69e48, 0xc0005a45c0, 0xc00010f780, 0x1ad01c0, 0xc0000c9218, 0x0, 0x0, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:330 +0x17f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0002ca0e0, 0x1c69e48, 0xc0005a45c0, 0xc00025a230, 0xc00062ede0, 0x1ad01c0, 0xc0000c9218, 0x0, 0x0, 0x0, ...)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:456 +0x67b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00065a000, 0x1c69e48, 0xc0005a45c0, 0xc000252370, 0xc0005a45c0, 0x1aa8040, 0xc0005b6700)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:955 +0x8ef
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ApplyResourceChange(0xc0004818c0, 0x1c69ef0, 0xc0005a45c0, 0xc00025a000, 0xc0004818c0, 0xc0005b67e0, 0xc0006bfba0)
	github.com/hashicorp/[email protected]/tfprotov5/server/server.go:332 +0xb5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1aa8040, 0xc0004818c0, 0x1c69ef0, 0xc0005b67e0, 0xc000280840, 0x0, 0x1c69ef0, 0xc0005b67e0, 0xc00035aa80, 0x9d2)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001a0000, 0x1c726d8, 0xc000783680, 0xc000310100, 0xc00007e6c0, 0x2163520, 0x0, 0x0, 0x0)
	google.golang.org/[email protected]/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0001a0000, 0x1c726d8, 0xc000783680, 0xc000310100, 0x0)
	google.golang.org/[email protected]/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0000ba2e0, 0xc0001a0000, 0x1c726d8, 0xc000783680, 0xc000310100)
	google.golang.org/[email protected]/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:857 +0x1fd

Error: The terraform-provider-redash_v0.6.0 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

You need to keep in mind, that python data source can be created without any additional options. Ideally provider should allow omitting options {} entirely, but passing empty options is a valid case.

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