I'm trying to deploy a Postgres Server on Azure. ...
# golang
c
I'm trying to deploy a Postgres Server on Azure. One of the properties of the server's args require a
pulumi.Input
, but the related structs defined in the package (e.g. this one) do not implement the interface. For this reason, the example in the docs just errs. Is there some simple way to implement
pulumi.Input
for a general struct? Should I do this myself? Is this a bug?
I just noticed that I can try different versions of the API until I find one that works for me, e.g.
Copy code
dbforpostgresql "<http://github.com/pulumi/pulumi-azure-native/sdk/go/azure/dbforpostgresql/v20221201|github.com/pulumi/pulumi-azure-native/sdk/go/azure/dbforpostgresql/v20221201>"
The root-level package seems to have issues
s
If you don’t mind, can you open an issue so we can look into this?
c
Of course: https://github.com/pulumi/pulumi-azure-native/issues/2407 I'm new to Pulumi and wasn't sure if there was some
AsInput
or similar helper available to sort out the inconsistency.
s
Thanks for opening the issue. Are you able to share your code, or at least the relevant snippets? It’s possible there’s a way to make it work.
c
The example won't compile. There are other errors in the example which I could fix just by changing types. Those are fixable and explainable by documentation drift. However, I could not figure out how to satisfy the
pulumi.Input
interface for the
.Properties
field
Here's a simplified version:
Copy code
package main

import (
	dbforpostgresql "<http://github.com/pulumi/pulumi-azure-native/sdk/go/azure/dbforpostgresql|github.com/pulumi/pulumi-azure-native/sdk/go/azure/dbforpostgresql>"
	"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
			Properties: dbforpostgresql.ServerPropertiesForDefaultCreate{},
		})
		return nil
	})
}
Copy code
./main.go:11:16: cannot use dbforpostgresql.ServerPropertiesForDefaultCreate{} (value of type dbforpostgresql.ServerPropertiesForDefaultCreate) as pulumi.Input value in struct literal: dbforpostgresql.ServerPropertiesForDefaultCreate does not implement pulumi.Input (missing method ElementType)
I updated the issue with some more thoughts and the example above.
s
Thanks for updating the issue; more information is almost always helpful!