https://pulumi.com logo
#general
Title
# general
r

rough-rain-68282

10/04/2021, 7:42 AM
Hello I need some help, can I somehow get the security group ID from the group name, I am trying to create multiple SGs from a single file using
Copy code
aws.ec2.SecurityGroupRule
this leads me to a problem where the newly created groups cannot be referenced in other groups using the name. The field
Copy code
security_group_id
expects a sg id. Not sure how I can get that dynamically . Thanks
a

ambitious-father-68746

10/04/2021, 9:10 AM
You need to "get" the security group and then you can get the id. One of these should help, probably the first one: • https://www.pulumi.com/docs/reference/pkg/aws/ec2/getsecuritygroup/https://www.pulumi.com/docs/reference/pkg/aws/ec2/getsecuritygroups/
r

rough-rain-68282

10/04/2021, 11:59 AM
Thanks