https://pulumi.com logo
#general
Title
# general
f

full-dress-10026

11/27/2018, 8:56 PM
I am trying to create a
Network
from an existing VPC with this code:
Copy code
const network = infra.Network.fromVpc("network", {
    vpcId: datomicVpcId,
    subnetIds: datomicSubnets,
    publicSubnetIds: datomicSubnets,
    securityGroupIds: [appSecurityGroupId],
    usePrivateSubnets: false
});
subnetIds
and
publicSubnetIds
are marked as
Type 'Output<any[]>' is not assignable to type 'Input<Input<string>>[]'
.
datomicSubnets
is defined as:
Copy code
export let datomicSubnets = datomicStorageStack.outputs.apply(o => [o["Subnet0"], o["Subnet1"], o["Subnet2"]]);
Is there a way to make this work?
l

lemon-spoon-91807

11/27/2018, 10:08 PM
something is weird with the quoting 🙂
w

white-balloon-205

11/27/2018, 10:08 PM
Does this work:
Copy code
export let datomicSubnets = [
    datomicStorageStack.outputs.apply(o => o["Subnet0"]),
    datomicStorageStack.outputs.apply(o => o["Subnet1"]),
    datomicStorageStack.outputs.apply(o => o["Subnet1"]),
];
That type
Input<Input<string>>[]
is very odd though - looks like that's probably a bug in the implementation of
Network
? (There are two layers of
Input
around
string
, but none around the
[]
as is normal)
@lemon-spoon-91807 Do you know if that type is intentional?
l

lemon-spoon-91807

11/27/2018, 10:10 PM
@white-balloon-205, this is because we have code that enumerates the subnets using .Length
w

white-balloon-205

11/27/2018, 10:10 PM
But then why are there two `Input`s here?
l

lemon-spoon-91807

11/27/2018, 10:10 PM
that part makes no sense
f

full-dress-10026

11/27/2018, 10:10 PM
@white-balloon-205’s solution worked.
l

lemon-spoon-91807

11/27/2018, 10:11 PM
it should either be:
Input<string>[]
or
Input<Input<string>[]>
.
the latter would not work for our needs though because we do resource construction based on the array length.
w

white-balloon-205

11/27/2018, 10:11 PM
Right - and sounds like it needs to be the former due the the enumeration of subnets.
@white-balloon-205’s solution worked.
Great.
l

lemon-spoon-91807

11/27/2018, 10:12 PM
i will fix this up in my PR as well
the Input<Input> issue