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

aws_security_group does not create a security group #20537

Closed
ktasper opened this issue Aug 12, 2021 · 3 comments
Closed

aws_security_group does not create a security group #20537

ktasper opened this issue Aug 12, 2021 · 3 comments
Labels
documentation Introduces or discusses updates to documentation. service/ec2 Issues and PRs that pertain to the ec2 service.

Comments

@ktasper
Copy link

ktasper commented Aug 12, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Either the docs are wrong or the resource is broken. I have used this in the past with no issues.

Terraform CLI and Terraform AWS Provider Version

Terraform v1.0.4
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v3.53.0
+ provider registry.terraform.io/hashicorp/external v2.1.0
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/null v3.1.0

Affected Resource(s)

Terraform v1.0.4
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v3.53.0

Terraform Configuration Files

resource "aws_security_group" "allow_tls" {
  name        = "allow_tls"
  description = "Allow TLS inbound traffic"
  vpc_id      = aws_vpc.main.id

  ingress = [
    {
      description      = "TLS from VPC"
      from_port        = 443
      to_port          = 443
      protocol         = "tcp"
      cidr_blocks      = [aws_vpc.main.cidr_block]
      ipv6_cidr_blocks = [aws_vpc.main.ipv6_cidr_block]
    }
  ]

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

  tags = {
    Name = "allow_tls"
  }
}

Expected Behavior

  • It should create the SG with the rules specified

Actual Behavior

 Error: Incorrect attribute value type
│ 
│   on infra_sec_groups.tf line 141, in resource "aws_security_group" "allow_tls":
│  141:   ingress = [
│  142:     {
│  143:       description      = "TLS from VPC"
│  144:       from_port        = 443
│  145:       to_port          = 443
│  146:       protocol         = "tcp"
│  147:       cidr_blocks      = ["0.0.0.0/0"]
│  148:     }
│  149:   ]
│ 
│ Inappropriate value for attribute "ingress": element 0: attributes "ipv6_cidr_blocks", "prefix_list_ids", "security_groups", and "self" are required.
╵
╷
│ Error: Incorrect attribute value type
│ 
│   on infra_sec_groups.tf line 151, in resource "aws_security_group" "allow_tls":
│  151:   egress = [
│  152:     {
│  153:       from_port        = 0
│  154:       to_port          = 0
│  155:       protocol         = "-1"
│  156:       cidr_blocks      = ["0.0.0.0/0"]
│  157:       ipv6_cidr_blocks = ["::/0"]
│  158:     }
│  159:   ]
│ 
│ Inappropriate value for attribute "egress": element 0: attributes "description", "prefix_list_ids", "security_groups", and "self" are required.

Steps to Reproduce

  1. Use the example from the docs and it does not work.

  2. terraform apply

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/ec2 Issues and PRs that pertain to the ec2 service. labels Aug 12, 2021
@ewbankkit ewbankkit added documentation Introduces or discusses updates to documentation. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 12, 2021
@ewbankkit
Copy link
Contributor

Relates: #20428.

@ewbankkit
Copy link
Contributor

@K2Webby Thanks for raising this issue.
It has already been noticed in #20484. I'm going to close this one as a duplicate so that we can concentrate discussion in the linked issue.
Please add any additional comments there.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

No branches or pull requests

2 participants