Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[codegen/go] Inputty types elision removes necessary types from Azure-native go sdk #8918

Closed
TechnicallyJoe opened this issue Feb 2, 2022 · 5 comments
Assignees
Labels
area/codegen SDK-gen, program-gen, convert kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@TechnicallyJoe
Copy link

Hello!

  • Vote on this issue by adding a 👍 reaction
  • To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already)

Issue details

I'm trying to run set up a Postgresserver on Azure using the example shown here: https://www.pulumi.com/registry/packages/azure-native/api-docs/dbforpostgresql/server/#create-a-new-server

Copy-pasting this doesn't work because of this error:
cannot use (dbforpostgresql.ServerPropertiesForDefaultCreate literal) (value of type dbforpostgresql.ServerPropertiesForDefaultCreate) as pulumi.Input value in struct literal: missing method ElementTypecompilerInvalidIfaceAssign

Code i'm attempting to run:

_, err := dbforpostgresql.NewServer(ctx, "server", &dbforpostgresql.ServerArgs{
		Location: pulumi.String("westus"),
		Properties: dbforpostgresql.ServerPropertiesForDefaultCreate{
			AdministratorLogin:         "cloudsa",
			AdministratorLoginPassword: "<administratorLoginPassword>",
			CreateMode:                 "Default",
			MinimalTlsVersion:          "TLS1_2",
			SslEnforcement:             "Enabled",
			StorageProfile: dbforpostgresql.StorageProfile{
				BackupRetentionDays: 7,
				GeoRedundantBackup:  "Disabled",
				StorageMB:           128000,
			},
		},
		
		ResourceGroupName: pulumi.String("TestGroup"),
		ServerName:        pulumi.String("pgtestsvc4"),
		Sku: &dbforpostgresql.SkuArgs{
			Capacity: pulumi.Int(2),
			Family:   pulumi.String("Gen5"),
			Name:     pulumi.String("B_Gen5_2"),
			Tier:     pulumi.String("Basic"),
		},
		Tags: pulumi.StringMap{
			"ElasticServer": pulumi.String("1"),
		},
	})
	if err != nil {
		return err
	}

Steps to reproduce

The example shown here: https://www.pulumi.com/registry/packages/azure-native/api-docs/dbforpostgresql/server/#create-a-new-server

Expected: No error when using the struct shown in the example.
Actual: Got an error

cannot use (dbforpostgresql.ServerPropertiesForDefaultCreate literal) (value of type dbforpostgresql.ServerPropertiesForDefaultCreate) as pulumi.Input value in struct literal: missing method ElementTypecompilerInvalidIfaceAssign

@TechnicallyJoe TechnicallyJoe added the kind/bug Some behavior is incorrect or out of spec label Feb 2, 2022
@TechnicallyJoe
Copy link
Author

I have found a temporary fix.

I've tested each version going down to v1.50.0. It appears on Version 1.51.0 dbforpostgresql.ServerPropertiesForDefaultCreateArgs was removed. Reverting to 1.50.0 and using that is my temporary solution.

@viveklak viveklak self-assigned this Feb 3, 2022
@viveklak viveklak added the needs-repro Needs repro steps before it can be triaged or fixed label Feb 3, 2022
@viveklak
Copy link
Contributor

viveklak commented Feb 3, 2022

This seems to have been the result of #7943.

The following commit is the squash of pulumi/pulumi-azure-native#1372 which upgraded to v3.20.0 of pulumi/pulumi codegen where the above PR was integrated.

git log -p feda773226239b126edd65834cfc75b090e89518 sdk/go/azure/dbforpostgresql/pulumiTypes.go

-
-
-
-type ServerPropertiesForRestoreInput interface {
-       pulumi.Input
-
-       ToServerPropertiesForRestoreOutput() ServerPropertiesForRestoreOutput
-       ToServerPropertiesForRestoreOutputWithContext(context.Context) ServerPropertiesForRestoreOutput
-}
-
-type ServerPropertiesForRestoreArgs struct {
-       CreateMode               pulumi.StringInput         `pulumi:"createMode"`
-       InfrastructureEncryption pulumi.StringPtrInput      `pulumi:"infrastructureEncryption"`
-       MinimalTlsVersion        pulumi.StringPtrInput      `pulumi:"minimalTlsVersion"`
-       PublicNetworkAccess      pulumi.StringPtrInput      `pulumi:"publicNetworkAccess"`
-       RestorePointInTime       pulumi.StringInput         `pulumi:"restorePointInTime"`
-       SourceServerId           pulumi.StringInput         `pulumi:"sourceServerId"`
-       SslEnforcement           SslEnforcementEnumPtrInput `pulumi:"sslEnforcement"`
-       StorageProfile           StorageProfilePtrInput     `pulumi:"storageProfile"`
-       Version                  pulumi.StringPtrInput      `pulumi:"version"`
-}
-
-func (ServerPropertiesForRestoreArgs) ElementType() reflect.Type {
-       return reflect.TypeOf((*ServerPropertiesForRestore)(nil)).Elem()
-}
....

Which corresponds to

@viveklak viveklak transferred this issue from pulumi/pulumi-azure-native Feb 3, 2022
@viveklak viveklak changed the title PostgresServer.Properties with ServerPropertiesForDefaultCreate doesn't work [codegen/go] Inputty types elision removes necessary types from Azure-native go sdk Feb 3, 2022
@viveklak viveklak added area/codegen SDK-gen, program-gen, convert and removed needs-repro Needs repro steps before it can be triaged or fixed labels Feb 3, 2022
@radirobi
Copy link

Dear @viveklak @TechnicallyJoe

the relevant package for Azure Database for MySQL is affected by this bug as well.
Do you have some estimates when this bug will be resolved? Thanks.

@Zaid-Ajaj
Copy link
Contributor

I believe this is fixed by #14679 but we need a new version of azure-native modules published in order to close it out

@Zaid-Ajaj Zaid-Ajaj added the resolution/fixed This issue was fixed label May 23, 2024
@Zaid-Ajaj
Copy link
Contributor

I believe this is no longer an issue. In azure-native v2, missing Args variant of types were re-enabled and the example https://www.pulumi.com/registry/packages/azure-native/api-docs/dbforpostgresql/server/#create-a-new-server should now work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/codegen SDK-gen, program-gen, convert kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

4 participants