You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OmitType and TypeName to support sharing types (#2409)
Introduce OmitType and TypeName flags to enforce type sharing.
Some of the upstream providers generate very large concrete schemata. TF
is not being materially affected, just high RAM demands for in-memory
processing. The example is inspired by QuickSight types in AWS. Pulumi
is affected significantly. In Pulumi the default projection is going to
generate named types for every instance of the shared schema. This leads
to SDK bloat and issues with "filename too long."
With this change it is possible for the provider maintainer opt into
explicit sharing of types, and ensure that the type names for the shared
types have shorter meaningful prefixes.
At definition type the user can specify the type name to generate, which
can be very short, and replace the automatically implied
ReallyLongPrefixedTypeName like this:
```go
"visuals": {
Elem: &info.Schema{
TypeName: tfbridge.Ref("Visual"),
},
},
```
At reference time in another resource, the user can reuse an already
generated type by token. This already worked before this change but had
the downside of still generating unused helper types and causing SDK
bloat.
```go
"visuals": {
Elem: &info.Schema{
Type: "testprov:index/Visual:Visual",
},
},
```
With this change it is possible to instruct the bridge to stop
generating the unused helper types:
```go
"visuals": {
Elem: &info.Schema{
Type: "testprov:index/Visual:Visual",
OmitType: true
},
},
```
0 commit comments