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

Security groups for allow all and all ports keeps reloading #1729

Closed
mzupan opened this issue Apr 29, 2015 · 12 comments
Closed

Security groups for allow all and all ports keeps reloading #1729

mzupan opened this issue Apr 29, 2015 · 12 comments

Comments

@mzupan
Copy link
Contributor

mzupan commented Apr 29, 2015

I'm running a pretty current master

Terraform v0.5.0-dev (fa85e6b7692b816df0c784f8339e0446bb3a4dc9+CHANGES)

I have the following

resource "aws_security_group" "internal-default" {
    name = "WEB-internal-defaults"
    description = "Allow set traffic from internal"
    vpc_id = "${aws_vpc.main.id}"

    ingress {
        from_port = -1
        to_port = -1
        protocol = "icmp"
        cidr_blocks = ["10.0.0.0/8"]
    }
    ingress {
        from_port = 22
        to_port = 22
        protocol = "tcp"
        cidr_blocks = ["10.0.0.0/8"]
    }

    tags {
        Name = "Web - Default Internal"
        CostCenter = "Web"
    }
}

It keeps trying to alter the security group each apply

aws_security_group.internal-nat: Modifying...
  ingress.2767533351.cidr_blocks.#:     "0" => "1"
  ingress.2767533351.cidr_blocks.0:     "" => "10.0.0.0/8"
  ingress.2767533351.from_port:         "" => "0"
  ingress.2767533351.protocol:          "" => "-1"
  ingress.2767533351.security_groups.#: "0" => "0"
  ingress.2767533351.self:              "" => "0"
  ingress.2767533351.to_port:           "" => "65535"
aws_security_group.internal-nat: Modifications complete
aws_instance.nat: Modifying...
  vpc_security_group_ids.#:          "1" => "2"
  vpc_security_group_ids.2847372475: "" => "sg-45297821"
  vpc_security_group_ids.3329033720: "sg-f6347892" => "sg-f6347892"
aws_instance.nat: Modifications complete
@c4milo
Copy link
Contributor

c4milo commented May 1, 2015

I'm running into this issue as well (master branch)

@catsby
Copy link
Contributor

catsby commented May 1, 2015

hey @mzupan and @c4milo , can you give me some more information?

I used the config file you specified, applied it, and then ran plan expecting to see a change but didn't. terraform refresh doesn't change the state file either. What am I missing, in the steps to reproduce this?

I'm on Terraform v0.5.0-dev (15c75c501f97de2205e2779ac2f432d615a92fed+CHANGES)

@catsby catsby added the waiting-response An issue/pull request is waiting for a response from the community label May 1, 2015
@c4milo
Copy link
Contributor

c4milo commented May 2, 2015

@catsby, try this one:

resource "aws_security_group" "foo" {
    ingress {
        protocol = "-1"
        from_port = 8300
        to_port = 8300
        cidr_blocks = ["10.0.1.0/24"]
    }

    // Allows ingress traffic to all ports from subnet A.
    ingress {
        protocol = "-1"
        from_port = 0
        to_port = 65535
        cidr_blocks = ["10.0.0.0/24"]
    }
}

@catsby
Copy link
Contributor

catsby commented May 4, 2015

I'd like to close this as a duplicate of #1177 if you don't mind. Essentially, from what I'm reading, a protocol of -1 translates to to_port: 0 and from_port: 0 on AWS's side, so any config that has different will constantly want to change.

Of course, I could be wrong, so let me know what you think.

@catsby
Copy link
Contributor

catsby commented May 4, 2015

To clarify:

I can't reproduce the first case given. I note that the example config has resource "aws_security_group" "internal-default" , with no port 65535 mentioned in the config, but the output has aws_security_group.internal-nat: Modifying... mentioned, and does include port 65535. Is that a typo then?

The second example from @c4milo is a duplicate of #1177 , I believe.

@mzupan
Copy link
Contributor Author

mzupan commented May 4, 2015

@catsby thanks.. switching the to/from ports from -1 to 0 cleared it up

@c4milo
Copy link
Contributor

c4milo commented May 5, 2015

@catsby, thanks for looking into this.

@catsby
Copy link
Contributor

catsby commented May 5, 2015

Is this OK to close then?

@mzupan
Copy link
Contributor Author

mzupan commented May 5, 2015

ok to close on my end

@c4milo
Copy link
Contributor

c4milo commented May 5, 2015

I think so.

@phinze phinze closed this as completed May 7, 2015
@phinze phinze removed the waiting-response An issue/pull request is waiting for a response from the community label May 7, 2015
@GNK-Cloud
Copy link

GNK-Cloud commented Dec 10, 2017

resource "aws_security_group" "foo" {
    ingress {
        protocol = "tcp"
        from_port = 8300
        to_port = 8300
        cidr_blocks = ["10.0.1.0/24"]
    }

    // Allows ingress traffic to all ports from subnet A.
    ingress {
        protocol = "-1"
        from_port = 0
        to_port = 65535
        cidr_blocks = ["10.0.0.0/24"]
    }

@ghost
Copy link

ghost commented Apr 5, 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 Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants