https://pulumi.com logo
#golang
Title
# golang
g

gifted-city-99717

04/28/2020, 6:28 PM
has anyone run into this when building a provider? I’m seeing a type assertion that’s failing on code that was geneated. It’s saying github.com/hashicorp/terraform-plugin-sdk/helper/schema.Provider doesn’t implement github.com/hashicorp/terraform/terraform.ResourceProvider (wrong type for Apply) full stack trace:
Copy code
♥ λ make
===============
grafana Package
===============
BUILD:
cd provider && go install -ldflags "-X <http://github.com/crasiak/pulumi-grafana/provider/pkg/version.Version=v0.0.1-dev.1588091482+gbc899c3.dirty|github.com/crasiak/pulumi-grafana/provider/pkg/version.Version=v0.0.1-dev.1588091482+gbc899c3.dirty>" <http://github.com/crasiak/pulumi-grafana/provider/cmd/pulumi-tfgen-grafana|github.com/crasiak/pulumi-grafana/provider/cmd/pulumi-tfgen-grafana>
# <http://github.com/crasiak/pulumi-grafana/provider|github.com/crasiak/pulumi-grafana/provider>
./resources.go:98:25: impossible type assertion:
	*"<http://github.com/hashicorp/terraform-plugin-sdk/helper/schema|github.com/hashicorp/terraform-plugin-sdk/helper/schema>".Provider does not implement "<http://github.com/hashicorp/terraform/terraform|github.com/hashicorp/terraform/terraform>".ResourceProvider (wrong type for Apply method)
		have Apply(*"<http://github.com/hashicorp/terraform-plugin-sdk/terraform|github.com/hashicorp/terraform-plugin-sdk/terraform>".InstanceInfo, *"<http://github.com/hashicorp/terraform-plugin-sdk/terraform|github.com/hashicorp/terraform-plugin-sdk/terraform>".InstanceState, *"<http://github.com/hashicorp/terraform-plugin-sdk/terraform|github.com/hashicorp/terraform-plugin-sdk/terraform>".InstanceDiff) (*"<http://github.com/hashicorp/terraform-plugin-sdk/terraform|github.com/hashicorp/terraform-plugin-sdk/terraform>".InstanceState, error)
		want Apply(*"<http://github.com/hashicorp/terraform/terraform|github.com/hashicorp/terraform/terraform>".InstanceInfo, *"<http://github.com/hashicorp/terraform/terraform|github.com/hashicorp/terraform/terraform>".InstanceState, *"<http://github.com/hashicorp/terraform/terraform|github.com/hashicorp/terraform/terraform>".InstanceDiff) (*"<http://github.com/hashicorp/terraform/terraform|github.com/hashicorp/terraform/terraform>".InstanceState, error)
./resources.go:119:3: cannot use preConfigureCallback (type func(resource.PropertyMap, *"<http://github.com/hashicorp/terraform/terraform|github.com/hashicorp/terraform/terraform>".ResourceConfig) error) as type tfbridge.PreConfigureCallback in field value
make: *** [tfgen] Error 2
and go.mod looks like:
Copy code
module <http://github.com/crasiak/pulumi-grafana/provider|github.com/crasiak/pulumi-grafana/provider>

go 1.13

replace <http://github.com/Azure/go-autorest|github.com/Azure/go-autorest> => <http://github.com/Azure/go-autorest|github.com/Azure/go-autorest> v12.4.3+incompatible

require (
	<http://github.com/hashicorp/terraform|github.com/hashicorp/terraform> v0.12.2
	<http://github.com/hashicorp/terraform-plugin-sdk|github.com/hashicorp/terraform-plugin-sdk> v1.8.0
	<http://github.com/pulumi/pulumi-terraform-bridge/v2|github.com/pulumi/pulumi-terraform-bridge/v2> v2.0.0
	<http://github.com/pulumi/pulumi/sdk/v2|github.com/pulumi/pulumi/sdk/v2> v2.0.0
	<http://github.com/terraform-providers/terraform-provider-grafana|github.com/terraform-providers/terraform-provider-grafana> v1.5.0
)
b

busy-umbrella-36067

04/29/2020, 2:02 PM
are you trying to port the grafana provider? I had it compiling here a while ago: https://github.com/mazamats/pulumi-grafana
g

gifted-city-99717

04/29/2020, 4:29 PM
yeah, I was thinking of it. but this is great! thank you!
3 Views