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

Error authorizing security group ingress rules: InvalidGroup.NotFound: Unable to find group .. #1261

Open
alexflav23 opened this issue Jul 27, 2017 · 2 comments
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.

Comments

@alexflav23
Copy link

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Terraform v0.9.11

Affected Resource(s)

  • aws_security_group

Terraform Configuration Files

resource "aws_security_group" "some-elb" {
  name = "some-elb"

  ingress {
    from_port = 80
    to_port = 80
    protocol = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }

  ingress {
    from_port = 443
    protocol = "tcp"
    to_port = 9443
    cidr_blocks = ["0.0.0.0/0"]
  }
}


/**
 * Security group used by instances in the ElasticBeanstalk Environment.
 * This group will allow instances to be accessed from the load balancer only,
 * preventing external ingress using `ManagedSecurityGroup` setting.
 */
resource "aws_security_group" "some-web-sg" {
  name = "some-web-sg"

  ingress {
    from_port = "${var.server_port}"
    to_port = "${var.server_port}"
    protocol = "tcp"
    security_groups = ["${aws_security_group.some-elb.id}"]
  }

  ingress {
    from_port = "${var.elb_https_port}"
    protocol = "tcp"
    to_port = "${var.https_server_port}"
    security_groups = ["${aws_security_group.some-elb.id}"]
  }

  ingress {
    from_port = "${var.https_server_port}"
    protocol = "tcp"
    to_port = "${var.https_server_port}"
    security_groups = ["${aws_security_group.some-elb.id}"]
  }

  egress {
    from_port = 0
    to_port = 0
    protocol = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Expected Behaviour

Security group inter dependencies should be automatically established at provisioning time and accounted for, to make sure we do not attempt to create a security group before its dependencies.

Actual Behavior

Security groups are either not created or not created in the proper sequence. Creating the security group for instances does not create the dependency security group beforehand.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
  2. terraform plan

References

@radeksimko radeksimko added the bug Addresses a defect in current functionality. label Jul 28, 2017
@bflad bflad added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jan 28, 2018
@zioalex
Copy link

zioalex commented Jan 29, 2020

Please can you provide a debug output?

@TaiSHiNet
Copy link

We had similar issues and it was due to the SG missing the vpc_id parameter, so it was being created in EC2-Clasic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

No branches or pull requests

5 participants