pulumi / pulumi-terraform-bridge

A library allowing providers built with the Terraform Plugin SDK to be bridged into Pulumi.
Apache License 2.0
183 stars 41 forks source link

[Plugin Framework] Support CustomType #803

Open t0yv0 opened 1 year ago

t0yv0 commented 1 year ago

Plugin Framework has the Custom Types feature but the bridge does not yet support it.

@tmeckel reports that on upgrade-tf-framework the current version of the bridge fails ungracefully:

Failed to translate type compositeIdType[2] to Pulumi

This blocks:

tmeckel commented 1 year ago

@t0yv0 the error message has definitely improved:

image

t0yv0 commented 1 year ago

CC @iwahbe

Ah so still a blocker. This may actually just need https://github.com/pulumi/pulumi-terraform-bridge/issues/731 Set Type proper it looks like rather than the complete "Custom Type" with all that that entails.

tmeckel commented 1 year ago

@t0yv0 @iwahbe I think #803 must be implemented, because the MSSQL TF Provider uses this new feature of TF PF.

image

https://github.com/PGSSoft/terraform-provider-mssql/blob/5f4f6a8945461714b83f0b24278f4f62d3feb18d/internal/services/serverPermission/resource.go#L31

t0yv0 commented 1 year ago

Excellent than your for the specific use case.

iwahbe commented 1 year ago

Ah so still a blocker. This may actually just need #731 Set Type proper it looks like rather than the complete "Custom Type" with all that that entails.

AFAIK, the Plugin Framework custom types are constructed on top of a base type. https://github.com/pulumi/pulumi-terraform-bridge/pull/808 added logic for custom types to be translated into their base type.

https://github.com/pulumi/pulumi-terraform-bridge/blob/a1cfd555358fba787c3019b5f233f7bd3f88b4e8/pf/internal/schemashim/convert_type.go#L29-L33

Of course, not implementing the base type is still a problem. I believe that this will work when we complete #731.

iwahbe commented 4 months ago

Recording the learnings from https://github.com/pulumi/pulumi-terraform-bridge/pull/1674, to support custom types we need to remove any usage of types.*Type in favor of basetypes.*Typable. The types library exists to provide convenient implementations of basetypes, but if fundamentally optional.