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

steep-printer-55468

12/04/2019, 10:39 PM
I'm using
awsx.ec2.Vpc
to manage VPCs. I have a VPC that previously didn't configure any NAT gateways. I just updated it with
numberofNatGateways: 2
to add some gateways but Pulumi doesn't detect the change. Is that a bug? If not, what am I doing wrong? And if so... how do I work around it?
more on this... seems like `numberOfNatGateways`doesn't work at all
I tried creating a new VPC specifying nat gateways and it doesn't show any nat gateways in the resources to create
l

lemon-spoon-91807

12/05/2019, 1:06 AM
hey @steep-printer-55468 can you show me the code you're sing to make the Vpc?
s

steep-printer-55468

12/05/2019, 2:33 AM
Copy code
const privateVpc = new awsx.ec2.Vpc("private", {
        cidrBlock: "10.255.0.0/16",
        numberOfAvailabilityZones: 2,
        numberOfNatGateways: 2,
        subnets: [
            { type: "private", name: "private", cidrMask: 24 },
            { type: "isolated", name: "database", cidrMask: 24 },
        ]
    });
I've worked around it in the meantime with this
Copy code
for (let subnet of privateVpc.privateSubnets) {
        let gw = privateVpc.addNatGateway(`natgw-${subnet.subnetName}`, {
            subnet: subnet.id,
        });

        subnet.createRoute(`natgw-route-${subnet.subnetName}`, {
            destinationCidrBlock: "0.0.0.0/0",
            natGatewayId: gw.natGateway.id,
        });
    }
had an epiphany just now
I am a giant dope and tried to assign nat gateways in a private subnet, which obviously won't work
Pulumi 1, man and his keyboard 0