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

able-machine-72645

09/18/2023, 10:00 PM
Hey all, running into this issue:
Copy code
Diagnostics:
  pulumi:pulumi:Stack (superstate-jon-dev):
    Error: invocation of aws:ec2/getVpc:getVpc returned an error: invoking aws:ec2/getVpc:getVpc: 1 error occurred:
    	* no matching EC2 VPC found
    : Error: invocation of aws:ec2/getVpc:getVpc returned an error: invoking aws:ec2/getVpc:getVpc: 1 error occurred:
    	* no matching EC2 VPC found
        at Object.callback (/snapshot/awsx/node_modules/@pulumi/pulumi/runtime/invoke.js:148:33)
        at Object.onReceiveStatus (/snapshot/awsx/node_modules/@grpc/grpc-js/src/client.ts:338:26)
        at Object.onReceiveStatus (/snapshot/awsx/node_modules/@grpc/grpc-js/src/client-interceptors.ts:426:34)
        at Object.onReceiveStatus (/snapshot/awsx/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48)
        at /snapshot/awsx/node_modules/@grpc/grpc-js/src/call-stream.ts:276:24
        at processTicksAndRejections (node:internal/process/task_queues:78:11)

    error: Error: invocation of aws:ec2/getVpc:getVpc returned an error: invoking aws:ec2/getVpc:getVpc: 1 error occurred:
    	* no matching EC2 VPC found


        at Object.callback (/snapshot/awsx/node_modules/@pulumi/pulumi/runtime/invoke.js:148:33)
        at Object.onReceiveStatus (/snapshot/awsx/node_modules/@grpc/grpc-js/src/client.ts:338:26)
        at Object.onReceiveStatus (/snapshot/awsx/node_modules/@grpc/grpc-js/src/client-interceptors.ts:426:34)
        at Object.onReceiveStatus (/snapshot/awsx/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48)
        at /snapshot/awsx/node_modules/@grpc/grpc-js/src/call-stream.ts:276:24
        at processTicksAndRejections (node:internal/process/task_queues:78:11)
    error: Running program '/Users/jon/Developer/superstate/devops/index.ts' failed with an unhandled exception:
    <ref *1> Error: failed to register new resource loadbalancer [awsx:lb:ApplicationLoadBalancer]: 2 UNKNOWN: invocation of aws:ec2/getVpc:getVpc returned an error: invoking aws:ec2/getVpc:getVpc: 1 error occurred:
    	* no matching EC2 VPC found


        at Object.registerResource (/Users/jon/Developer/superstate/devops/node_modules/@pulumi/runtime/resource.ts:421:27)
        at new Resource (/Users/jon/Developer/superstate/devops/node_modules/@pulumi/resource.ts:507:13)
        at new ComponentResource (/Users/jon/Developer/superstate/devops/node_modules/@pulumi/resource.ts:1011:9)
        at new ApplicationLoadBalancer (/Users/jon/Developer/superstate/devops/node_modules/@pulumi/lb/applicationLoadBalancer.ts:98:9)
        at Object.<anonymous> (/Users/jon/Developer/superstate/devops/index.ts:142:22)
        at Module._compile (node:internal/modules/cjs/loader:1241:14)
        at Module.m._compile (/Users/jon/Developer/superstate/devops/node_modules/ts-node/src/index.ts:439:23)
        at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
        at Object.require.extensions.<computed> [as .ts] (/Users/jon/Developer/superstate/devops/node_modules/ts-node/src/index.ts:442:12)
        at Module.load (node:internal/modules/cjs/loader:1091:32) {
      promise: Promise { <rejected> [Circular *1] }
    }
I’m trying to: 1. Create a VPC 2. Create an application load balance in that VPC
Copy code
const vpc = new awsx.ec2.Vpc("superstate-vpc", {});

const loadbalancerSecurityGroup = new aws.ec2.SecurityGroup("loadbalancerSecurityGroup", {
    vpcId: vpc.vpcId,
    ingress: [{
        fromPort: 0,
        toPort: 0,
        protocol: "-1",
        cidrBlocks: ["0.0.0.0/0"],
        ipv6CidrBlocks: ["::/0"],
    }],
    egress: [{
        fromPort: 0,
        toPort: 65535,
        protocol: "TCP",
        cidrBlocks: ["0.0.0.0/0"],
        ipv6CidrBlocks: ["::/0"],
    }],
});

// Create a load balancer to listen for requests and route them to the container.
const loadbalancer = new awsx.lb.ApplicationLoadBalancer("loadbalancer", {
    securityGroups: [ loadbalancerSecurityGroup.id ]
});
Any thoughts on what’s going wrong?
b

billowy-army-68599

09/18/2023, 10:19 PM
@able-machine-72645 can you try specifying a cidr block for the VPC? I think it’s falling back to retrieving the VPC which is a bug
a

able-machine-72645

09/18/2023, 10:38 PM
Tried both:
const vpc = new awsx._ec2_._Vpc_("superstate-vpc", { cidrBlock: "10.0.0.0/16" });
and
const vpc = new awsx.ec2.Vpc("superstate-vpc", { cidrBlock: "172.16.8.0/24" });
same issue unfortunately
Is there an argument I need to pass the ALB to tell it to use the VPC I created instead of the default one?
b

billowy-army-68599

09/18/2023, 10:43 PM
likely the vpc public subnet ids
a

able-machine-72645

09/18/2023, 10:45 PM
that was it! Thank you!
2 Views