This message was deleted.
# general
s
This message was deleted.
s
Does your account have ec2 classic?
If so, you won’t have a default vpc and have no option but to create a new vpc instead
a
@stocky-spoon-28903 Yea we have some instances on ec2 classic. I tried using an existing VPC as mentioned:
Copy code
let ptQaVpc = awsx.ec2.Vpc.fromExistingIds('pt_qa_vpc', {
  vpcId: 'vpc-555555'
});
But I get the same error, and I cannot tell what code is calling
getVpc
, how would I figure that out?
s
@lemon-spoon-91807 is probably the best person to help here
a
@lemon-spoon-91807 So I’ve tried both ways below to plugin my existing VPC, but I’m still getting the error above.
pulumi preview --debug -v 3
unfortunately is not much help, I can see the
Invoke
call failing, but cannot figure out the caller in my pulumi code that is causing it.
Copy code
let ptQaVpc = awsx.ec2.Vpc.fromExistingIds('pt_qa_vpc', {
  vpcId: 'vpc-5b964120'
});

// Does not work? Seems I'm required to use awsx Vpc class.
// let ptQaVpc = aws.ec2.Vpc.get('pt_qa_vpc', 'vpc-5b964120');

// Create an elastic network listener to listen for requests and route them to the container.
const ptNetworkLoadBalancer = new awsx.elasticloadbalancingv2.ApplicationLoadBalancer(
  "pt_network_load_balancer",
  {
    external: true,
    vpc: ptQaVpc
  }
);
Logging Output (snippet):
Copy code
debug: RegisterResourceOutputs RPC finished: urn=urn:pulumi:qa::pt-site::awsx:x:ecs:Cluster$awsx:x:ec2:SecurityGroup$awsx:x:ec2:IngressSecurityGroupRule::default-cluster-containers; err: null, resp:
    debug: Invoke RPC finished: tok=aws:ec2/getVpc:getVpc; err: Error: 2 UNKNOWN: invocation of aws:ec2/getVpc:getVpc returned an error: invoking aws:ec2/getVpc:getVpc: no matching VPC found, resp: undefi
ned
    error: Running program '/Users/richard/tuts/js/pt-site/deployment' failed with an unhandled exception:
    Error: invocation of aws:ec2/getVpc:getVpc returned an error: invoking aws:ec2/getVpc:getVpc: no matching VPC found
        at monitor.invoke (/Users/richard/tuts/js/pt-site/deployment/node_modules/@pulumi/pulumi/runtime/invoke.js:73:33)
        at Object.onReceiveStatus (/Users/richard/tuts/js/pt-site/deployment/node_modules/grpc/src/client_interceptors.js:1205:9)
        at InterceptingListener._callNext (/Users/richard/tuts/js/pt-site/deployment/node_modules/grpc/src/client_interceptors.js:568:42)
        at InterceptingListener.onReceiveStatus (/Users/richard/tuts/js/pt-site/deployment/node_modules/grpc/src/client_interceptors.js:618:8)
        at callback (/Users/richard/tuts/js/pt-site/deployment/node_modules/grpc/src/client_interceptors.js:845:24)
    debug: ReadResource RPC finished: resource:pt_qa_vpc[aws:ec2/vpc:Vpc]#...; err: null, resp: urn:pulumi:qa::pt-site::aws:ec2/vpc:Vpc::pt_qa_vpc,
@lemon-spoon-91807 Not sure if you saw this, but do you have any ideas for where I have to specify my Vpc for working around the above problem?
l
Hrmm!
I'm at home now. Can look tomorrow
Do you have some sample code I can look at?
Generally we will get the default vpc if you don't supply it for a few resources
But if have to look them up
a
Sure, I can DM you the code