This message was deleted.
# general
s
This message was deleted.
f
Yes — you can use the v2 CLI with v1 projects.
a
great, thats good news
@faint-table-42725 Regarding my 2nd question, this code typechecks on v2, but now pulumi is trying to delete my vpc, which is not what I want.
Copy code
const vpcId = stackRef.requireOutput('vpcId');
const vpcPrivateSubnetIds = (stackRef.requireOutput('vpcPrivateSubnetIds') as unknown) as pulumi.Output<string>[];
const vpcPublicSubnetIds = (stackRef.requireOutput('vpcPublicSubnetIds') as unknown) as pulumi.Output<string>[];
const vpc = awsx.ec2.Vpc.fromExistingIds('vpc', {
  privateSubnetIds: vpcPrivateSubnetIds,
  publicSubnetIds: vpcPublicSubnetIds,
  vpcId,
});
f
What does the diff show?
I don’t know if you can cast like that because I would expect the actual type to be
Output<string[]>
?
a
I ended up casting to Output<string[]> like you said, and it does work if I then wrap the rest of my code in apply, like so:
Copy code
const vpcId = stackRef.requireOutput('vpcId');
let vpcPrivateSubnetIds = stackRef.requireOutput('vpcPrivateSubnetIds') as pulumi.Output<string[]>;
let vpcPublicSubnetIds = stackRef.requireOutput('vpcPublicSubnetIds') as pulumi.Output<string[]>;

pulumi.all([vpcPrivateSubnetIds, vpcPublicSubnetIds]).apply(([priv, pub]) => {
  const vpc = awsx.ec2.Vpc.fromExistingIds('vpc', {
    privateSubnetIds: priv,
    publicSubnetIds: pub,
    vpcId,
  });
...