freezing-artist-36980
09/09/2022, 3:23 AMawsx
and it throws an error at assigning public subnet ID from newly created VPC to a new EC2 instance. Please help me.
const vpc = new awsx.ec2.Vpc("my-vpc");
// Create bastion host
const bastionHost = new awsc.ec2.Instance("bastion-host", {
ami: ami.id,
instanceType: awsc.ec2.InstanceTypes.T2_Micro,
associatePublicIpAddress: true,
// Reference the public subnet from the custom vpc above
subnetId: vpc.publicSubnetIds.apply(x => x![0]), // ! Property apply does not exist on type ...
vpcSecurityGroupIds: [ec2SecurityGroup.id],
keyName: sshKey.keyName,
});
little-cartoon-10569
09/09/2022, 5:30 AMapply()
. subnetId: vpc.publicSubnetIds[0]
works fine.freezing-artist-36980
09/09/2022, 6:01 AM1. Element implicitly has an 'any' type because expression of type '0' can't be used to index type 'Promise<Output<string>[]>'.
Property '0' does not exist on type 'Promise<Output<string>[]>'.
little-cartoon-10569
09/09/2022, 7:15 AMsubnetId: pulumi.output(vpc.publicSubnetIds)[0]
freezing-artist-36980
09/09/2022, 4:59 PM