salmon-account-74572
06/25/2020, 10:27 PMec2.NewSubnet
) across AZs within a region, and then I "capture" the ID of the created subnets in an array (this happens near the end of a for
loop):
pubSubnetIds[idx] = subnet.ID()
Later, I can reference that array when I create a NAT Gateway with `ec2.NewNatGateway`:
SubnetId: pubSubnetIds[0],
However, I can't do the same thing with route table associations in a for
loop:
SubnetId: pubSubnetIds[idx],
In that usage, Pulumi reports that "cannot use privSubnetIds[idx] (type pulumi.StringInput) as type pulumi.StringPtrInput in field value". I get that they are different types (apparently), but...
a) why are they apparently different types between resources?
b) how is someone supposed to know this other than trial-and-error?
c) what is the workaround/solution?wet-egg-6347
06/25/2020, 11:00 PMsalmon-account-74572
06/25/2020, 11:05 PMlemon-agent-27707
06/25/2020, 11:31 PMsubnet.ID()
is a pulumi.IDOutput
which implements pulumi.StringOutput
and pulumi.IDPointerOutpur
but not pulumi.StringPointerOutput
.salmon-account-74572
06/26/2020, 3:30 PMlemon-agent-27707
06/26/2020, 3:32 PMsalmon-account-74572
06/26/2020, 3:33 PMmodule aws-get-azs
go 1.14
require (
<http://github.com/pulumi/pulumi-aws/sdk/v2|github.com/pulumi/pulumi-aws/sdk/v2> v2.0.0
<http://github.com/pulumi/pulumi/sdk/v2|github.com/pulumi/pulumi/sdk/v2> v2.0.0
)
lemon-agent-27707
06/26/2020, 4:04 PMStringInput
and other input methods that implement the corresponding ptr type don't have the appropriate methods declared on their interfaces even thought the methods are implemented. The type error goes away when I make this change to my SDK locally.salmon-account-74572
06/26/2020, 4:27 PMlemon-agent-27707
06/30/2020, 6:56 PM<http://github.com/pulumi/pulumi/sdk/v2|github.com/pulumi/pulumi/sdk/v2> v2.5.1-0.20200630183524-a8a20ecb4b1d
and then run go mod download
salmon-account-74572
06/30/2020, 6:59 PMgo.mod
and ran go mod download
, and I can confirm that it did fix the original problem (although VS Code's Go IntelliSense still thinks there's a problem). Unfortunately, now all instances of using Pulumi.Map
to create AWS tags are broken. I'll create a separate thread to discuss that.