sparse-intern-71089
02/16/2024, 3:27 PMbroad-doctor-18421
02/16/2024, 3:43 PMsubnet_infos = private_subnets.ids.apply(lambda ids: [get_subnet_info(id) for id in ids])
Did you try that syntax?acceptable-accountant-117
02/16/2024, 3:45 PMacceptable-accountant-117
02/16/2024, 3:48 PMAttributeError: 'list' object has no attribute 'apply'
acceptable-accountant-117
02/16/2024, 3:48 PMbroad-doctor-18421
02/16/2024, 3:50 PMsubnet is Output<TOKEN:asdf23lkj>
But the code internally will just handle it, and you don't have to know if you're dealing with a string or an output.broad-doctor-18421
02/16/2024, 3:51 PMacceptable-accountant-117
02/16/2024, 3:52 PMminiature-musician-31262
02/18/2024, 9:16 PMid
property of the subnet that was looked up, which I think is what you want.miniature-musician-31262
02/18/2024, 9:18 PMsubnet_info = aws.ec2.get_subnet(id=subnet_id)
to this:
subnet_info = aws.ec2.get_subnet(id=subnet_id).id
you get:
Diagnostics:
pulumi:pulumi:Stack (aws-python-bec8f14-dev):
['subnet-03e8c4a257e371bcc', 'subnet-013f2322ca6908836', 'subnet-08fbebe8d8aaa51af']
miniature-musician-31262
02/18/2024, 9:20 PMminiature-musician-31262
02/18/2024, 9:22 PMimport pulumi_aws as aws
vpc = aws.ec2.Vpc.get("existing-vpc", id="vpc-abc123")
def get_subnets_info(private_subnets):
subnets_info = []
for subnet_id in private_subnets:
subnet_info = aws.ec2.get_subnet(id=subnet_id).id
subnets_info.append(subnet_info)
return subnets_info
private_subnets = aws.ec2.get_subnets(filters=[{"name": "vpc-id", "values": [vpc.id]}],tags={"SubnetType":"Private"})
subnets_info = get_subnets_info(private_subnets.ids)
print(subnets_info)