icy-london-58403
10/20/2020, 11:23 PM// AZ args for the vpc
type AZ struct {
pulumi.ResourceState
}
// NewAZ makes a new AZ for the VPC to test NAT
func NewAZ(ctx *pulumi.Context, name string, args *AZArgs, opts ...pulumi.ResourceOption) (*AZ, error) {
...
...
...
ctx.RegisterResourceOutputs(AZ, pulumi.Map{
"PublicSubnetID": publicSubnet.ID(),
"PrivateSubnetID": privateSubnet.ID(),
})
return AZ, nil
}
I need the IDs of the subnets being created.lemon-agent-27707
10/20/2020, 11:27 PMicy-london-58403
10/20/2020, 11:34 PMctx.RegisterResourceOutputs
that the documentation emphasizes is important.
This example you sent makes sense. But what then is the point of registering resource outputs besides telling pulumi that your component is completed?
The call toalso tells Pulumi that the resource is done registering children and should be considered fully constructed, so—although it’s not enforced—the best practice is to call it in all components even if no outputs need to be registered.registerOutputs
lemon-agent-27707
10/20/2020, 11:52 PMicy-london-58403
10/20/2020, 11:53 PMlemon-agent-27707
10/20/2020, 11:53 PMicy-london-58403
10/20/2020, 11:55 PM