I am trying to create a `Network` from an existing...
# general
f
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
something is weird with the quoting 🙂
w
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
@white-balloon-205, this is because we have code that enumerates the subnets using .Length
w
But then why are there two `Input`s here?
l
that part makes no sense
f
@white-balloon-205’s solution worked.
l
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
Right - and sounds like it needs to be the former due the the enumeration of subnets.
@white-balloon-205’s solution worked.
Great.
l
i will fix this up in my PR as well
the Input<Input> issue