f

    flaky-arm-38472

    1 month ago
    This example seems to be wrong.
    package main
    
    import (
    	"fmt"
    
    	"<http://github.com/pulumi/pulumi-aws/sdk/v5/go/aws/rds|github.com/pulumi/pulumi-aws/sdk/v5/go/aws/rds>"
    	"<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 := rds.NewCluster(ctx, "default", &rds.ClusterArgs{
    			ClusterIdentifier: pulumi.String("aurora-cluster-demo"),
    			AvailabilityZones: pulumi.StringArray{
    				pulumi.String("us-west-2a"),
    				pulumi.String("us-west-2b"),
    				pulumi.String("us-west-2c"),
    			},
    			DatabaseName:   pulumi.String("mydb"),
    			MasterUsername: pulumi.String("foo"),
    			MasterPassword: pulumi.String("barbut8chars"),
    		})
    		if err != nil {
    			return err
    		}
    		var clusterInstances []*rds.ClusterInstance
    		for key0, val0 := range 2 {
    			__res, err := rds.NewClusterInstance(ctx, fmt.Sprintf("clusterInstances-%v", key0), &rds.ClusterInstanceArgs{
    				Identifier:        pulumi.String(fmt.Sprintf("aurora-cluster-demo-%v", val0)),
    				ClusterIdentifier: _default.ID(),
    				InstanceClass:     pulumi.String("db.r4.large"),
    				Engine:            _default.Engine,
    				EngineVersion:     _default.EngineVersion,
    			})
    			if err != nil {
    				return err
    			}
    			clusterInstances = append(clusterInstances, __res)
    		}
    		return nil
    	})
    }
    Specifically the ranging when creating the clusterInstances
    (for key0, val0 := range 2)
    . Range does not work like in Python. In go that range 2 will throw an error becasue first is an untyped int and second thats not how range works.
    b

    billowy-army-68599

    1 month ago
    these examples are autogenerated, so entirely possible it’s wrong
    f

    flaky-arm-38472

    1 month ago
    Ok, thanks. How are they autogenerated? which tool is used if you dont mind me asking.
    b

    billowy-army-68599

    1 month ago
    they are extracted from the terraform examples using pulumi terraform bridge
    s

    stocky-restaurant-98004

    1 month ago
    @flaky-arm-38472 I filed a bug for this. Feel free to upvote or comment: https://github.com/pulumi/pulumi-terraform-bridge/issues/593