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

colossal-australia-65039

11/11/2020, 9:45 PM
I'm getting a type error with this code
Copy code
import * as aws from "@pulumi/aws"
import * as awsx from "@pulumi/awsx"

const vpc = aws.ec2.Vpc.get('vpc_name', 'vpc-39485703984509')
const listener = new awsx.lb.NetworkListener("nginx", { vpc, port: 80 })
Copy code
index.ts(18,57): error TS2740: Type 'Vpc' is missing the following properties from type 'Vpc': vpc, initialize, addInternetGateway, addNatGateway, and 12 more.
how can i reference an already-existing resource and use it with crosswalk?
l

little-cartoon-10569

11/11/2020, 9:53 PM
The awsx equivalent of
aws.ec2.Vpc.get()
is
awsx.ec2.Vpc.fromExistingIds()
. Update your code and see if it helps?
c

colossal-australia-65039

11/11/2020, 9:55 PM
ah yeah that works. I don't see an equivalent method for
awsx.ecs.Cluster
however...
l

little-cartoon-10569

11/11/2020, 9:57 PM
I have found that the awsx packages don't offer many advantages for existing infra. If you're going to import or use as-is, you might just stick with the core features. If there's bits of the awsx code you would benefit from, maybe you could copy it?
👍 1
c

colossal-australia-65039

11/11/2020, 9:58 PM
thanks Paul!
3 Views