Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VPC error on NAT Gateway strategy #931

Closed
aaronkao opened this issue Oct 24, 2022 · 6 comments
Closed

VPC error on NAT Gateway strategy #931

aaronkao opened this issue Oct 24, 2022 · 6 comments
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@aaronkao
Copy link
Contributor

What happened?

Trying to create VPC with AWSX. Upon specifying subnetSpecs an error is given on NAT Gateway strategy

Error: If NAT Gateway strategy is 'OnePerAz' or 'Single', both private and public subnets must be declared. The private subnet creates the need for a NAT Gateway, and the public subnet is required to host the NAT Gateway resource.: Error: If NAT Gateway strategy is 'OnePerAz' or 'Single', both private and public subnets must be declared. The private subnet creates the need for a NAT Gateway, and the public subnet is required to host the NAT Gateway resource.

Steps to reproduce

name: test-project3
description: A minimal AWS Pulumi YAML program
runtime: yaml

configuration:
    vpcNetworkCidr:
        type: String
        default: 10.0.0.0/16
resources:  
    # Create a VPC
    vm-vpc:
        type: awsx:ec2:Vpc
        properties:
            enableDnsHostnames: true
            cidrBlock: ${vpcNetworkCidr}
            natGateways:
                strategy: OnePerAz
            subnetSpecs:
                - type: awsx.ec2.SubnetType.Public
                  cidrMask: 16    
                - type: awsx.ec2.SubnetType.Private
                  cidrMask: 16 
        
outputs:
    subnets: ${vm-vpc.publicSubnetIds}

Expected Behavior

VPC to be created

Actual Behavior

 pulumi:pulumi:Stack (test-project3-dev):
    error: [runtime] Error [ERR_INSPECTOR_NOT_AVAILABLE]: Inspector is not available
        at new NodeError (node:internal/errors:371:5)
        at node:inspector:23:9
        at NativeModule.compileForInternalLoader (node:internal/bootstrap/loaders:312:7)
        at NativeModule.compileForPublicLoader (node:internal/bootstrap/loaders:252:10)
        at loadNativeModule (node:internal/modules/cjs/helpers:49:9)
        at Function.Module._load (node:internal/modules/cjs/loader:804:15)
        at Module.require (node:internal/modules/cjs/loader:1005:19)
        at Module.require (pkg/prelude/bootstrap.js:1812:31)
        at require (node:internal/modules/cjs/helpers:102:18)
        at /snapshot/bin/node_modules/@pulumi/pulumi/runtime/closure/v8Hooks.js:44:62
 
    error: [runtime] Error [ERR_INSPECTOR_NOT_AVAILABLE]: Inspector is not available
        at new NodeError (node:internal/errors:371:5)
        at node:inspector:23:9
        at NativeModule.compileForInternalLoader (node:internal/bootstrap/loaders:312:7)
        at NativeModule.compileForPublicLoader (node:internal/bootstrap/loaders:252:10)
        at loadNativeModule (node:internal/modules/cjs/helpers:49:9)
        at Function.Module._load (node:internal/modules/cjs/loader:804:15)
        at Module.require (node:internal/modules/cjs/loader:1005:19)
        at Module.require (pkg/prelude/bootstrap.js:1812:31)
        at require (node:internal/modules/cjs/helpers:102:18)
        at /snapshot/bin/node_modules/@pulumi/pulumi/runtime/closure/v8Hooks.js:44:62
    Error: If NAT Gateway strategy is 'OnePerAz' or 'Single', both private and public subnets must be declared. The private subnet creates the need for a NAT Gateway, and the public subnet is required to host the NAT Gateway resource.: Error: If NAT Gateway strategy is 'OnePerAz' or 'Single', both private and public subnets must be declared. The private subnet creates the need for a NAT Gateway, and the public subnet is required to host the NAT Gateway resource.
        at validateNatGatewayStrategy (/snapshot/bin/ec2/vpc.js:234:19)
        at Vpc.initialize (/snapshot/bin/ec2/vpc.js:52:9)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
 
    error: Error: If NAT Gateway strategy is 'OnePerAz' or 'Single', both private and public subnets must be declared. The private subnet creates the need for a NAT Gateway, and the public subnet is required to host the NAT Gateway resource.
        at validateNatGatewayStrategy (/snapshot/bin/ec2/vpc.js:234:19)
        at Vpc.initialize (/snapshot/bin/ec2/vpc.js:52:9)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
    error: an unhandled error occurred: waiting for RPCs: rpc error: code = Unknown desc = If NAT Gateway strategy is 'OnePerAz' or 'Single', both private and public subnets must be declared. The private subnet creates the need for a NAT Gateway, and the public subnet is required to host the NAT Gateway resource.

Output of pulumi about

CLI          
Version      3.43.1
Go Version   go1.19.1
Go Compiler  gc

Plugins
NAME  VERSION
awsx  unknown
yaml  unknown

Host     
OS       ubuntu
Version  20.04
Arch     x86_64

This project is written in yaml

Current Stack: dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/aaronkao
User           aaronkao
Organizations  aaronkao, kao, upstarts, demo

No dependencies found

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@aaronkao aaronkao added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 24, 2022
@danielrbradley
Copy link
Member

What version of awsx are you using? It appears the pulumi CLI plugin listing isn't picking it up correctly.

@danielrbradley danielrbradley removed the needs-triage Needs attention from the triage team label Oct 25, 2022
@aaronkao
Copy link
Contributor Author

awsx 1.0.0-beta.5

@scottslowe
Copy link

I noticed that you're using a /16 for both the VPC CIDR and the subnet CIDRs. Normally the subnet CIDR would be something like /19, /20, or similar. Could you try adjusting the CIDR for the subnets to see if the error still persists?

@jkodroff
Copy link
Member

jkodroff commented Nov 4, 2022

@aaronkao This should be fixed in a more recent version of AWSX. Try -beta.11 or later.

@jaxxstorm
Copy link
Contributor

Having a similar issue with YAML:

name: ecs_mastdon
runtime: yaml
description: Stand up an ECS cluster with mastodon
template:
  config:
    aws:region:
      description: The AWS region to deploy into
      default: us-west-2
configuration:
  vpcNetworkCidr:
    type: String
    default: 172.16.0.0/22
resources:
  # Create a VPC for the EKS cluster
  vpc:
    type: awsx:ec2:Vpc
    properties:
      enableDnsHostnames: true
      cidrBlock: ${vpcNetworkCidr}
      natGateways:
        strategy: "None"

Error:

Diagnostics:
  pulumi:pulumi:Stack (ecs_mastdon-dev):
    TypeError: Cannot read properties of undefined (reading 'id'): TypeError: Cannot read properties of undefined (reading 'id')
        at /snapshot/awsx/bin/ec2/vpc.js:158:125
        at Array.forEach (<anonymous>)
        at Vpc.initialize (/snapshot/awsx/bin/ec2/vpc.js:97:18)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)

    error: an unhandled error occurred: waiting for RPCs: rpc error: code = Unknown desc = Cannot read properties of undefined (reading 'id')

@jaxxstorm
Copy link
Contributor

This was fixed in #885

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

5 participants