# aws


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 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: and 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 which I think is different and only responds with SecurityGroup with embedded ingress/egress instead referencing the SecurityGroupEgress/Ingress resources.


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