Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self referential ingress rules for security groups #167

Closed
albertrdixon opened this issue Aug 8, 2014 · 6 comments
Closed

Self referential ingress rules for security groups #167

albertrdixon opened this issue Aug 8, 2014 · 6 comments

Comments

@albertrdixon
Copy link

Terraform complains if I try to make ingress rules that reference the security group itself.
Example:

example.tf

resource "aws_security_group" "example" {
    name = "example"
    ...
    ingress {
        from_port = 22
        to_port = 22
        protocol = "tcp"
        security_groups = ["${aws_security_group.example.id}"]
    }
}

and the output I get:

Error creating graph: The dependency graph is not valid:

* Cycle: aws_security_group.example
@alekstorm
Copy link
Contributor

This would be fixed with the new resource types I suggest in #28 (comment).

@albertrdixon
Copy link
Author

Cool, yeah adding ingress and egress types would certainly work. At the least, some mechanism by which security group rules are added to the SG after the SG is created so that the id attribute exists.

@mitchellh
Copy link
Contributor

A certain amount of self-referential variables would actually in theory work (in practice it doesn't right now), but we're not yet looking to support this. I think @alekstorm's suggestion is the best.

@mitchellh
Copy link
Contributor

(closing this in favor of just racking on #28)

@wazoo
Copy link

wazoo commented Apr 24, 2015

For Google continuity I wanted to note that there is now a "self" parameter on ingress and egress rules that allows this behavior: http://www.terraform.io/docs/providers/aws/r/security_group.html

@ghost
Copy link

ghost commented May 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants