https://pulumi.com logo
Title
b

brash-waiter-28842

07/03/2021, 6:06 AM
Hi #getting-started. trying to test out Pulumi automation API using golang. I am trying to create a GCP VPC in one stack and a GKE cluster in another. I am using local backend. The VPC works fine:
net, err := compute.NewNetwork(ctx, infraName, networkConf)
		if err != nil {
			return err
		}

ctx.Export("vpcName", net.Name)
Here’s the output of it getting created:
Updating (mars-vpc):

 +  pulumi:pulumi:Stack gcp-mars-vpc creating 
 +  gcp:compute:Network mars-vpc creating 
 +  gcp:compute:Network mars-vpc created 
 +  pulumi:pulumi:Stack gcp-mars-vpc created 
 
Outputs:
    vpcName: "mars-vpc"

Resources:
    + 2 created
For GKE, I am trying to get the `vpcName`:
vpcStack, err := pulumi.NewStackReference(ctx, vpcStackName, nil)
	if err != nil {
		panic(err)
	}
vpcName := vpcStack.GetOutput(pulumi.String("vpcName"))
gkeConf := &container.ClusterArgs{
			Description: pulumi.StringPtr(fmt.Sprintf("GKE created for %s-krate", strings.Split(stack, "-")[0])),
			Location:    pulumi.StringPtr("asia-southeast2"),
			Name:        pulumi.StringPtr(infraName),
			Network: vpcName.ApplyT(func(v string) string {
				return v
			}).(pulumi.StringOutput),
		}
But i get this error:
stderr: error: an unhandled error occurred: go inline source runtime error, an unhandled error occurred:: applier must have 1 input parameter assignable from interface {}
what am i missing? any help would be appreciated…