Is there any guidance on overriding the type of a ...
# general
s
Is there any guidance on overriding the type of a field in the
resources.go
file of the AWS provider with an array type? I thought
tokens.NewArrayTypeToken(awsType(autoscalingMod+"/notificationType", "NotificationType"))
may have been it, but that panics at generation time complaining of a missing module delimiter. I don’t see anything of this form in either the GCP or AWS definitions.
b
Oops, a panic is no good. The NewArrayTypeToken stuff is mostly a holdover from our old runtime model (cc @bitter-oil-46081 as I know you are incrementally cleaning this up). Can you share the stack trace? We should fix the assert at least. The way to override element types is by using the
Elem
field in the override schema. See https://github.com/pulumi/pulumi-terraform/blob/162f81021f6f157711bd231e5599cae82b4af57a/pkg/tfbridge/info.go#L67. A good example of this in action is here: https://github.com/pulumi/pulumi-aws/blob/13fb8673da2bbe681435cf97e989ffa037c76d3e/resources.go#L876. Note that the type must be a slice in the Terraform schema for overlaying an array to work. HTH!
s
Aha, that’s got it. I’ll repro the stack trace another time.
It doesn’t appear under “correct” usage, and making incorrect edits to
resource.go
is fair game for panics I guess.
I’ve fixed up pulumi-aws#251 based on this and force pushed for CI. Hopefully that’s it!