swift-agency-29333
03/28/2021, 3:47 PMbillowy-army-68599
03/28/2021, 6:54 PMswift-agency-29333
03/30/2021, 12:18 AMEc2_server, err = ec2.NewInstance(ctx, "fooInstance", &ec2.InstanceArgs{
Ami: pulumi.String("ami-005e54dee72cc1d00"),})
Ec2_server.ID() // this gives IDOutput type but I want this as string/*string.
little-cartoon-10569
03/30/2021, 12:35 AMwhite-balloon-205
03/30/2021, 1:33 AMIDOutput
to StringOutput
you can use .ToStringOutput()
https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v2@v2.23.2/go/pulumi#IDOutput.ToStringOutputswift-agency-29333
03/30/2021, 2:50 PMwhite-balloon-205
03/30/2021, 6:56 PMI am passing it to LookupInstance function which expects *string/string ID.You will need to call
LookupInstance
from inside the .ApplyT
callback. Schematically idoutput.ApplyT(func (id pulumi.ID) { return ec2.LookupInstance(... id ...).Ami })
.