Hi, I am trying to create a VPC and then query the...
# aws
b
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:
Copy code
* 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
Can you share some code snippets, so we can see what you’re trying to do?
b
Copy code
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
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. 🙂
🙏 1
b
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
@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.