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

big-pizza-47421

10/25/2021, 7:14 AM
So i've tried the simplest setup ever, VPC, Subnets, ECS with a single nginx service (most of this is from the AWSX WalkThrough) and yet it just doesn't seem to work. https://github.com/lsportsltd/main-infrastructure everything is in this repository. the ALB is losing it, if I don't put the public subnets explicitly in the code itself for the ALB it just doesn't work. Any help is appreciated!
b

billowy-army-68599

10/25/2021, 11:59 AM
@big-pizza-47421 this repo is private, so I can't see the code
b

big-pizza-47421

10/25/2021, 12:40 PM
@billowy-army-68599 check now
b

billowy-army-68599

10/25/2021, 12:48 PM
b

big-pizza-47421

10/25/2021, 1:10 PM
Copy code
import * as awsx from "@pulumi/awsx";
import { getStack } from "@pulumi/pulumi";

const baseTags = {
  ManagedBy: "Pulumi",
  PulumiStack: getStack(),
};

// Allocate a new VPC that uses all of the current region's availability zones:
const vpc = new awsx.ec2.Vpc(`lsports-${getStack()}`, {
  numberOfAvailabilityZones: "all",
  subnets: [
    { type: "public" },
    { type: "private" },
    { type: "isolated", name: "db" },
    { type: "isolated", name: "redis" },
  ],
  tags: baseTags,
});

// Export a few resulting fields to make them easy to use:
export const vpcId = vpc.id;
export const vpcPrivateSubnetIds = vpc.privateSubnetIds.then((x) => x);
export const vpcPublicSubnetIds = vpc.publicSubnetIds.then((x) => x);
export const vpcIsolatedIds = vpc.isolatedSubnetIds.then((x) => x);
similar to this or should I wrap the entire thing?
b

billowy-army-68599

10/25/2021, 1:11 PM
that should work, give it a try
b

big-pizza-47421

10/25/2021, 1:24 PM
Copy code
aws:lb:LoadBalancer (web-traffic):
    error: 1 error occurred:
        * error creating application Load Balancer: ValidationError: At least two subnets in two different Availability Zones must be specified
        status code: 400, request id: 65207448-409e-46c2-ba34-179f77d6cf98
Copy code
// Get all stack references
const network = new StackReference(config.require("networkingStack"));

const vpc = awsx.ec2.Vpc.fromExistingIds(`lsports-${getStack()}`, {
  vpcId: network.getOutput("vpcId"),
});

// Create a load balancer on port 80 and spin up two instances of Nginx.
const alb = new awsx.elasticloadbalancingv2.ApplicationLoadBalancer(
  "web-traffic",
  {
    vpc: vpc,
    tags: baseTags,
    subnets: output(vpc.publicSubnetIds),
  }
);
same issue
b

billowy-army-68599

10/25/2021, 1:26 PM
okay, can you show me your subnets in the console?
b

big-pizza-47421

10/25/2021, 1:28 PM
the output from the network stack
or debug and print it?
b

billowy-army-68599

10/25/2021, 1:29 PM
like, in the console.
b

big-pizza-47421

10/25/2021, 1:31 PM
Copy code
Diagnostics:
  pulumi:pulumi:Stack (ecs-dev):
    OutputImpl {
      __pulumiOutput: true,
      resources: [Function (anonymous)],
      allResources: [Function (anonymous)],
      isKnown: Promise { <pending> },
      isSecret: Promise { <pending> },
      promise: [Function (anonymous)],
      toString: [Function (anonymous)],
      toJSON: [Function (anonymous)]
    }
console.log(output(vpc.publicSubnetIds));
b

billowy-army-68599

10/25/2021, 1:32 PM
sorry, in the AWS console
b

big-pizza-47421

10/25/2021, 1:32 PM
and this is the outputs from the networking
Copy code
Outputs:
    vpcId              : "vpc-0de25ff80c4f18e36"
    vpcIsolatedIds     : [
        [0]: "subnet-03cb4892906fed6fa"
        [1]: "subnet-027da6b5bfb36fe83"
        [2]: "subnet-003b026a11a47d95b"
        [3]: "subnet-035c959ae50ef8795"
        [4]: "subnet-0efc0b8e24baa8dfc"
        [5]: "subnet-02d22c7521da6a133"
    ]
    vpcPrivateSubnetIds: [
        [0]: "subnet-0b55769ef38f6d70e"
        [1]: "subnet-071bceef2f5441848"
        [2]: "subnet-0fded38c0f6abd37d"
    ]
    vpcPublicSubnetIds : [
        [0]: "subnet-058d8455bdd57f0d0"
        [1]: "subnet-0af4ffeb0b8b784c8"
        [2]: "subnet-02ae9c8e80671ff76"
    ]
b

billowy-army-68599

10/25/2021, 1:33 PM
okay, can you verify the subnets are actually in different AZs for me
b

big-pizza-47421

10/25/2021, 1:34 PM
they are
if I put them hardcoded it's working
b

billowy-army-68599

10/25/2021, 1:35 PM
thanks, looks like a bug then. would you mind opening an issue for it
b

big-pizza-47421

10/25/2021, 1:37 PM
I wonder if that's an issue in the awsx module
or the way it's exported
6 Views