https://pulumi.com logo
#typescript
Title
# typescript
r

rhythmic-flag-11093

06/29/2020, 2:58 AM
Hey there - complete Pulumi noob here about to get thrown into a project, was wondering why it is when I try this:
Copy code
import * as awsx from "@pulumi/awsx";

// Allocate a new VPC with the default settings:
const vpc = new awsx.ec2.Vpc("custom");

// Export a few resulting fields to make them easy to use:
export const vpcId = vpc.id;
export const vpcPrivateSubnetIds = vpc.privateSubnetIds;
export const vpcPublicSubnetIds = vpc.publicSubnetIds;
from here: https://www.pulumi.com/docs/guides/crosswalk/aws/vpc/ I get this error:
Copy code
index.ts(6,13): error TS2554: Expected 2-3 arguments, but got 1.
It's referring to this line
Copy code
const vpc = new awsx.ec2.Vpc("custom");
Any feedback is appreciated
l

little-cartoon-10569

06/29/2020, 3:26 AM
You're missing the mandatory args argument, and optionally the opts argument.
That example is missing them too.
I smell a PR coming...
The constructor's formal parameters are:
constructor(name: string, args: VpcArgs | ExistingVpcArgs | ExistingVpcIdArgs, opts?: pulumi.ComponentResourceOptions);
So you must have the args parameter (no
?
after
args
). It looks like you can give it an empty args parameter though: haven't tried it, since the cidrBlock argument is essential for my use cases.
r

rhythmic-flag-11093

06/29/2020, 11:31 PM
Thank you so much - very helpful. I think they need to polish up that guide - especially that its aimed at people "Getting Started" 😞
It seemed from the guide that if you left all those blank, it would fill in some best-practice defaults or something 🤷‍♂️ Anyways, thank you so much!