https://pulumi.com logo
Title
b

broad-holiday-50009

02/28/2023, 10:13 PM
I'm building an ecs cluster and attempting to declare subnets I have 3 public and 3 private subnets under 2 different variables is there a way to include both under subnets = or does leaving that key out automatically select all
l

little-cartoon-10569

02/28/2023, 10:17 PM
Clusters are unrelated to subnets. Where are you trying to declare subnets?
b

broad-holiday-50009

02/28/2023, 10:18 PM
I'm using the pulumi documents to build it and they have a subnets key in there let me show you the code
my_HNO_cluster = aws.ecs.Cluster("my_HNO_cluster")
my_HNO_cluster = my_HNO_cluster.arn
network_configuration = aws.ecs.ServiceNetworkConfigurationArgs(
		subnets= priv_subnets,
		subnets= pub_subnets,
		security_groups = [sg.id],
),
desired_count = 1
it builds completely without the second subnets key
l

little-cartoon-10569

02/28/2023, 10:19 PM
Ah. You can't use the same key twice. Just create a collection with the contents of both priv_subnets and pub_subnets.
b

broad-holiday-50009

02/28/2023, 10:20 PM
that's the part of this I don't know how to do, I'm very new to Pulumi and just kinda stumbling through documentation to do this
l

little-cartoon-10569

02/28/2023, 10:20 PM
This is unrelated to Pulumi. It's just Python. Use "+".
b

broad-holiday-50009

02/28/2023, 10:21 PM
o ok I thought it was Pulumi specific
l

little-cartoon-10569

02/28/2023, 10:21 PM
Concatenating collections is normal Python stuff.
b

billowy-army-68599

02/28/2023, 10:21 PM
subnets takes a list:
subnets=[]
So instead of defining subnets twice:
subnets=
subnets=
just do
subnets= priv_subnets + pub_subnets
b

broad-holiday-50009

02/28/2023, 10:22 PM
awesome thank you
I'm still figuring out where python ends and Pulumi starts in some cases.
l

little-cartoon-10569

02/28/2023, 10:23 PM
Ask any time! You may also want to check out #python for language-specific help.
b

broad-holiday-50009

02/28/2023, 10:24 PM
thank you and thank you for the help. I've been a sys admin for 15yrs and never touched automation so trying to move into DevOps has been enlightening this stuff is so much fun and just fascinating it's like a whole new world to me
b

billowy-army-68599

02/28/2023, 10:27 PM
we’re here to help! if it’s any comfort, I was a sysadmin for 15 years and now I write pulumi all day 🙂
b

broad-holiday-50009

02/28/2023, 10:28 PM
nice well I hope one day to be where you are. I did a little terraform before this and Pulumi just seems to be lightyears ahead of it
l

little-cartoon-10569

02/28/2023, 10:31 PM
I've been a dev for 30 years and you are right. Pulumi is lightyears ahead.
(:high-five: @billowy-army-68599)
b

broad-holiday-50009

02/28/2023, 10:32 PM
every time I was manic I wanted to learn coding and I would get into it for about 2wks and then drop it when the novelty wore off. I think that's the draw to devops for me is that there's so much coding and I'm still not great at it but now that I'm mostly unfucked mentally I've really been enjoying writing code.