happy-window-22449
05/23/2021, 8:31 AMget_subnet_ids
like so:
import pulumi
import pulumi_aws as aws
from pulumi_aws.ec2.get_subnet_ids import get_subnet_ids
vpc = aws.ec2.DefaultVpc(f'default-vpc')
get_subnet_ids(vpc_id=vpc.id)
It returns:
Exception: invoke of aws:ec2/getSubnetIds:getSubnetIds failed: Missing required argument: The argument "vpc_id" is required, but no definition was found. ()
All I want to do is get the subnets associated with the default VPCfaint-whale-59078
05/23/2021, 8:45 AMvpc = aws.ec2.get_vpc(default=True)
print(vpc.arn)
...
happy-window-22449
05/23/2021, 9:21 AMvpc = aws.ec2.get_vpc(default=True)
works when vpc = aws.ec2.DefaultVpc(f'default-vpc')
does notfaint-whale-59078
05/23/2021, 9:38 AMThis is an advanced resource, and has special caveats to be aware of when using it. Please read this document in its entirety before using this resource.
import pulumi_aws as aws
vpc = aws.ec2.get_vpc(default=True)
subnet_ids = aws.ec2.get_subnet_ids(vpc_id=vpc.id)
print(subnet_ids.ids)
should output something similar to this:
['subnet-204bcd78', 'subnet-f66a7d91', 'subnet-22b1b06b']
happy-window-22449
05/24/2021, 7:01 AM