b

    brief-baker-41837

    1 month ago
    Hi, I am trying to create a VPC and then query the result object to get the private subnet but it is always failing with the following error during preview itself:
    * multiple EC2 Subnets matched; use additional constraints to reduce matches to a single EC2 Subnet
    I cant seem to figure out the cause specially when this is occurring in preview itself. Please help.
    s

    salmon-account-74572

    1 month ago
    Can you share some code snippets, so we can see what you’re trying to do?
    b

    brief-baker-41837

    1 month ago
    vpc = awsx.ec2.Vpc("pulumi-test",cidr_block='10.2.0.0/16',subnet_specs=[
          awsx.ec2.SubnetSpecArgs(
            type=awsx.ec2.SubnetType.PRIVATE,
            cidr_mask=26,
          ),
          awsx.ec2.SubnetSpecArgs(
            type=awsx.ec2.SubnetType.PUBLIC,
            cidr_mask=26,
          )
        ], number_of_availability_zones=1)
    
    subnet = aws.ec2.get_subnet(id=vpc.private_subnet_ids[0])
      security_group = aws.ec2.get_security_group(vpc_id=vpc.vpc_id)
    @salmon-account-74572 thoughts?
    s

    salmon-account-74572

    1 month ago
    Hey Akshay, I’ll take a look at this as soon as I have a chance. I’m just a community member trying to help, but right now my help can only be best-effort. 🙂
    b

    broad-toddler-72261

    1 month ago
    Did you ever get an answer to this? I have a similar problem whereby I created a VPC via the crosswalk - awsx.ec2.Vpc, which did create successfully, however I updated my script to include the creation of elasticsearch which needs the subnet, however get the ids (vpc.publicSubnetIds[0] returns the promise and not the value, which causes my elasticsearch to complain that I need to provide a valid subnet
    not that it is important, but i was actually attempting to access the isolatedSubnetIds - either way, they do not resolve. fyi - i did ad a { dependsOn: [vpc]} to my es config, does not help
    b

    brief-baker-41837

    1 month ago
    @broad-toddler-72261 i did not have a satisfactory answer to it. I did even put up a question in stackoverflow. There's no follow up answer to it. I have decided to run vpc creation isolated and then the rest of the stuff or rather move to terraform.