My code: ```test = aws.lb.LoadBalancer( "My...
# aws
a
My code:
Copy code
test = aws.lb.LoadBalancer(
							"MyTestALB",
							internal=False,
							load_balancer_type="application",
							security_groups=[alb_security_group.id],
							subnets=[__item["id"] for __item in aws_subnet["public"]],
							enable_deletion_protection=True,
							#access_logs=aws.lb.LoadBalancerAccessLogsArgs(
							#		bucket=
							#	)
						  )
I would like to understand what this line of code is saying:
Copy code
subnets=[__item["id"] for __item in aws_subnet["public"]],
My question is how am I going to get the subnets, because the lb documentation assumed that I already the code getting the subnets and it is assigned to aws_subnet["public"].
b
you need to pass a list of subnet ids there
a
When you said pass list of subnets ids, you mean this? https://www.pulumi.com/docs/reference/pkg/aws/ec2/getsubnetids/ I just started learning pulumi and totally no experience on this.
So far, what I have tried is this.
Copy code
example_subnet_ids = aws.ec2.get_subnet_ids(vpc_id="vpc-f...")
example_subnet = [aws.ec2.get_subnet(id=__value) for __key, __value in example_subnet_ids.ids]
I got this error after running pulumi preview.
Copy code
ValueError: too many values to unpack (expected 2)
b
hey @average-nest-71706 so the get_subnet_ids call will return a list of ids - you can then pass that list of subnet ids directly to the subnet parameter of LoadBalancer (which expects a list)