prehistoric-sandwich-7272
07/10/2022, 11:22 AMclusterArgs
the subnet ID’s of the VPC I have created in a different stack.
I am getting the output from the stack reference like this:
stack, err := pulumi.NewStackReference(ctx, Name, nil)
if err != nil {
log.Fatalf("Got error while trying to get a new stack reference! Error: %s", err)
}
VpcPublicSubnetIdsOutput := stack.GetStringOutput(pulumi.String("vpcPublicSubnetIds"))
vpcPrivateSubnetIdsOutput := stack.GetStringOutput(pulumi.String("vpcPrivateSubnetIds"))
VpcPublicSubnetIds := pulumi.ToStringArrayOutput([]pulumi.StringOutput{VpcPublicSubnetIdsOutput})
vpcPrivateSubnetIds := pulumi.ToStringArrayOutput([]pulumi.StringOutput{vpcPrivateSubnetIdsOutput})
So VpcPublicSubnetIds & vpcPrivateSubnetIds are both of type pulumi.StringArrayOutput
But I can’t figure out how to pass the subnet ID’s to the clusterArgs, by indexing the elements from VpcPublicSubnetIds & vpcPrivateSubnetIds !
I tried doing it like this:
eksCluster, err := eks.NewCluster(ctx, values.Name, &eks.ClusterArgs{
Name: pulumi.StringPtr(values.Name),
VpcId: vpcId,
PublicSubnetIds: pulumi.StringArray{
pulumi.StringInput(VpcPublicSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(0))),
pulumi.StringInput(VpcPublicSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(1))),
pulumi.StringInput(VpcPublicSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(2))),
pulumi.StringInput(VpcPublicSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(3))),
},
PrivateSubnetIds: pulumi.StringArray{
pulumi.StringInput(vpcPrivateSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(0))),
pulumi.StringInput(vpcPrivateSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(1))),
pulumi.StringInput(vpcPrivateSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(2))),
pulumi.StringInput(vpcPrivateSubnetIds.Index(<http://pulumi.Int|pulumi.Int>(3))),
},
what am I doing wrong?No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by