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 group rules: self conflicts with cidr_blocks #13

Closed
cmd-werner-diers opened this issue May 3, 2021 · 3 comments · Fixed by #14
Closed

Security group rules: self conflicts with cidr_blocks #13

cmd-werner-diers opened this issue May 3, 2021 · 3 comments · Fixed by #14
Labels
bug 🐛 An issue with the system

Comments

@cmd-werner-diers
Copy link

cmd-werner-diers commented May 3, 2021

Describe the Bug

With the latest provider hashicorp/aws v3.38.0 new restrictions have been added to aws_security_group_rule resource, then when running a terraform plan for

module "security_group" {
  source  = "cloudposse/security-group/aws//examples/complete"
  version = "0.1.4"

  vpc_id = "vpc-123456789"
    rules  = [
        {
            type        = "ingress"
            from_port   = 3389
            to_port     = 3389
            protocol    = "tcp"
            cidr_blocks = ["10.0.0.0/8"]
            description = "RDP"
        },
        {
            type        = "egress"
            from_port   = 433
            to_port     = 433
            protocol    = "tcp"
            cidr_blocks = ["10.0.0.0/8"]
            description = "HTTPS"
        }
    ]
}

I get the following error:

│ Error: ConflictsWith
│ 
│   on .terraform/modules/security_group/main.tf line 54, in resource "aws_security_group_rule" "default":
│   54:   cidr_blocks              = lookup(each.value, "cidr_blocks", null)
│ 
│ "cidr_blocks": conflicts with self

and

│ Error: ConflictsWith
│ 
│   on .terraform/modules/security_group/main.tf line 58, in resource "aws_security_group_rule" "default":
│   58:   self                     = lookup(each.value, "self", null) == null ? false : each.value.self
│ 
│ "self": conflicts with cidr_blocks

Expected Behavior

Plan is executed with no issues.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a terraform configuration with above example
  2. Run 'terraform init'
  3. Run 'terraform plan'
  4. See error

Screenshots

NA

Environment (please complete the following information):

Anything that will help us triage the bug will help. Here are some ideas:

  • OS: MacOS Big Sur or Amazon Linux
  • Version: lates
  • Terraform AWS provider hashicorp/aws v3.38.0
  • Terraform v 0.15.0
@cmd-werner-diers cmd-werner-diers added the bug 🐛 An issue with the system label May 3, 2021
@syphernl
Copy link

syphernl commented May 3, 2021

I can confirm this, it appears to be related to this change: hashicorp/terraform-provider-aws#15606

Here is the full changelog for v3.38.0.

@defnn
Copy link

defnn commented May 4, 2021

self is set to false when it should be null:

https://github.com/cloudposse/terraform-aws-security-group/blob/master/main.tf#L58

@sushant-pradhan
Copy link

Related to hashicorp/terraform-provider-aws#19179

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants