https://pulumi.com logo
#general
Title
# general
a

adamant-dress-73325

04/16/2019, 5:05 PM
Hi All, I received the following error when trying to run a preview for some code that was working on a test AWS account, but now does not work on our production account. Seems like its looking for a VPC that might not exist on older aws accounts? How can I debug something like this?
Copy code
Diagnostics:
  pulumi:pulumi:Stack (pt-site-qa):
    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)
s

stocky-spoon-28903

04/17/2019, 1:29 AM
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

adamant-dress-73325

04/17/2019, 4:29 PM
@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

stocky-spoon-28903

04/17/2019, 6:17 PM
@lemon-spoon-91807 is probably the best person to help here
a

adamant-dress-73325

04/18/2019, 7:34 PM
@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

lemon-spoon-91807

04/22/2019, 10:17 PM
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

adamant-dress-73325

04/22/2019, 10:19 PM
Sure, I can DM you the code
3 Views