worried-city-86458
09/14/2021, 3:51 AMOutput<ImmutableArray<string>>
(of aws subnet ids fwiw), I need to create a bunch of aws resources for each subnet.
Unless I'm missing something, there doesn't seem to be a nice way to enumerate the array outside of apply, since there's no way to get the array length, unless I use OutputUtilities
.var subnetCount = OutputUtilities.GetValueAsync(privateSubnetIds.Apply(ids => ids.Length)).GetAwaiter().GetResult();
for (var i = 0; i < subnetCount; ++i)
{
new MountTarget($"{awsEksPrefix}-efs-mount-target-{i + 1}",
new MountTargetArgs
{
FileSystemId = efsfileSystem.Id,
SecurityGroups = { efsSecurityGroup.Id },
SubnetId = privateSubnetIds.GetAt(i)
},
new CustomResourceOptions { Provider = awsProvider });
}
tall-librarian-49374
09/14/2021, 7:46 AMapply
. The snippet above may work but I’m curious why you think it’s better than a loop inside apply?bumpy-grass-54508
09/14/2021, 1:11 PMworried-city-86458
09/14/2021, 3:40 PMtall-librarian-49374
09/14/2021, 3:56 PMworried-city-86458
09/14/2021, 5:00 PMtall-librarian-49374
09/14/2021, 8:30 PM