https://pulumi.com logo
#aws
Title
# aws
g

gorgeous-pillow-13604

11/26/2023, 5:15 PM
I have two aws ec2 securitygroups that reference each other. I used the pulumi import to bring them in and I am now trying to swap out the hardcoded sg-blahblahblah text with the typescript reference-sg.id. The problem is they are both referencing each other so they would both need a dependson and the 1st one listed will not know what the 2nd one is because it appears below itself in the file. Essentially I am trying to figure out how I can solve a circular reference between resources. UPDATE: Okay so I found a couple links on AWS that point me in the right direction:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-securitygroup.html and https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-securitygroupegress.html. Basically I think I need to create a SecurityGroupEgress and SecurityGroupIngress that both reference the two SecurityGroups that have a circular reference. The problem/question I have is, I don't see how I can create an aws.ec2.SecurityGroupEgress and Ingress in Pulumi - the only thing I see is https://www.pulumi.com/registry/packages/aws/api-docs/vpc/securitygroupegressrule/ which I think is different and pulumi.ai only responds with SecurityGroup with embedded ingress/egress instead referencing the SecurityGroupEgress/Ingress resources.
b

brave-planet-10645

11/28/2023, 7:14 AM
The securitygrouprule resource is for doing precisely what you’re talking about. Where you want to add security groups (or other resources) and then add the ingress/egress rules later on