Closed timmyers closed 5 years ago
It is still possible to create bridged providers that do not use terraform-plugin-sdk
. If you clone this repo, remove the references to terraform-plugin-sdk
and pulumi-terraform-bridge
in go.mod
, then run GO111MODULE=on go get github.com/pulumi/pulumi-terraform@dotnet
, I think you should be in a good state.
Hmm I am still ending up with the same error when i try to make
:
❯ make
================
spotinst Package
================
BUILD:
go install -ldflags "-X github.com/timmyers/pulumi-spotinst/pkg/version.Version=v0.0.1-dev.1571759875+gf7c73e9.dirty" github.com/timmyers/pulumi-spotinst/cmd/pulumi-tfgen-spotinst
# github.com/timmyers/pulumi-spotinst
./resources.go:96:26: impossible type assertion:
*schema.Provider does not implement "github.com/hashicorp/terraform/terraform".ResourceProvider (wrong type for Apply method)
have Apply(*"github.com/hashicorp/terraform-plugin-sdk/terraform".InstanceInfo, *"github.com/hashicorp/terraform-plugin-sdk/terraform".InstanceState, *"github.com/hashicorp/terraform-plugin-sdk/terraform".InstanceDiff) (*"github.com/hashicorp/terraform-plugin-sdk/terraform".InstanceState, error)
want Apply(*"github.com/hashicorp/terraform/terraform".InstanceInfo, *"github.com/hashicorp/terraform/terraform".InstanceState, *"github.com/hashicorp/terraform/terraform".InstanceDiff) (*"github.com/hashicorp/terraform/terraform".InstanceState, error)
make: *** [tfgen] Error 2
EDIT: Looks like I needed to revert several import paths throughout the code as well (I'm not a go expert). I'm passed this error onto another one now. Will post if I cannot figure out.
Now I get the following when trying to build:
❯ make
================
spotinst Package
================
BUILD:
go install -ldflags "-X github.com/timmyers/pulumi-spotinst/pkg/version.Version=v0.0.1-dev.1571759875+gf7c73e9.dirty" github.com/timmyers/pulumi-spotinst/cmd/pulumi-tfgen-spotinst
go install -ldflags "-X github.com/timmyers/pulumi-spotinst/pkg/version.Version=v0.0.1-dev.1571759875+gf7c73e9.dirty" github.com/timmyers/pulumi-spotinst/cmd/pulumi-resource-spotinst
for LANGUAGE in "nodejs" "python" "go" ; do \
pulumi-tfgen-spotinst $LANGUAGE --overlays overlays/$LANGUAGE/ --out sdk/$LANGUAGE/ || exit 3 ; \
done
panic: fatal: An assertion has failed: expected to be able to safely pluralize name: gpu
The assertion panic happens even if I remove the item from the Resources
map that contains "gpu" (https://www.terraform.io/docs/providers/spotinst/r/elastigroup_gcp.html)
expected to be able to safely pluralize name: gpu
The error message isn't great - but this is likely because of a property named gpu
somewhere in this provider which will need to be mapped to a name explicitly. I do only see the one reference to gpu
you call out. Are you sure you aren't mapping that resource? Do you have a repo that contains a repro for this?
Ah I see, it is at https://github.com/timmyers/pulumi-spotinst.
I took the code from https://github.com/346/pulumi-spotinst/blob/master/resources.go, but am hoping to actually get this version fully building with the CI automation, and ideally under the pulumi
org in the end.
Based on commenting out resources one by one, it actually seems like spotinst_elastigroup_gke
is causing the error, even though I see no "gpu" field here https://www.terraform.io/docs/providers/spotinst/r/elastigroup_gke.html.
EDIT: Figured it out, this resource also has "gpu" field, but is not easily findable from the docs.
Yeah - I see it here: https://github.com/terraform-providers/terraform-provider-spotinst/blob/3ef0467be1df0f0691090e407da8f7fc93ff8039/spotinst/resource_spotinst_elastigroup_gke.go#L48 (rather indirectly).
I'm going to close this issue out - as I believe the originally reported issue had a suitable workaround, and I believe the second issue is something that can be solved in the provider. I'll open a separate issue on improving the assert error here.
Yes, solved, thanks!
Hi, I am trying to use this repo to create a provider for https://github.com/terraform-providers/terraform-provider-spotinst.
I believe this provider does not use the
terraform-plugin-sdk
. Are providers that do not use this still supported after #18?It seems there are type issues as a result, mismatches between the types that come from
pulumi-terraform-bridge
and those that come from the terraformhelper
packages used by the provider.